Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
ZIZI
Starting Member
1 Post |
Posted - 2008-11-18 : 13:21:16
|
I am making a database of employees, and I have 296 work units that I have to put into 65 category names. I was using The IIF statement, but I got a "too complex" message. Is there another way to group. here is part of my code:(IIf([ACTIVE EMPLOYEES].[WORKUNIT]='0001',"Comissioner's Staff", IIf([ACTIVE EMPLOYEES].[WORKUNIT]='0070',"Parks Advocate", IIf([ACTIVE EMPLOYEES].[WORKUNIT]='0009',"Asst Cmmr - CW services",IIf([ACTIVE EMPLOYEES].[WORKUNIT] in ('0026','0031'),"Arsenal Maintenance", IIf([ACTIVE EMPLOYEES].[WORKUNIT]='0019',"Arts & Antiquities", IIf([ACTIVE EMPLOYEES].[WORKUNIT]='0007',"Counsel", IIf([ACTIVE EMPLOYEES].[WORKUNIT]='0058',"Equal Employment Opportunity", IIf([ACTIVE EMPLOYEES].[WORKUNIT]='0062',"Greenthumb", IIf([ACTIVE EMPLOYEES].[WORKUNIT]='0034',"New Media", IIf([ACTIVE EMPLOYEES].[WORKUNIT]='0011',"Public Affairs",IIf([ACTIVE EMPLOYEES].[WORKUNIT]='0028',"Special Counsel",IIf([ACTIVE EMPLOYEES].[WORKUNIT]='0002',"Deputy Commissioner",IIf([ACTIVE EMPLOYEES].[WORKUNIT] between '6000' and '6015','0010',"Central Ops")))))))))))))) AS DivisionIf I add another statement after the last one I'll get a too complex message. I guess there is a limit. |
|
|
|
|
|
|