Question : Question on how deep can I go with the IIF()

I am using IIF() for a query but how many conditions can I nest in it before it would not be the best practice?

just a code that would be what I would do. This is not the real code but the idea is there. The second IIF() is where I would have maybe 6 conditions from 4 tables... Good or  bad?

Thanks
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
SELECT *, ;
 IIF(x=y,1,0) as X, ;
*-- This one would be the concern, it would have conditions 
*   between 4 tables
 IIF(x=y and z=55 and grp=s and via=1 and iloc=50,1,0) as xyz, ;
 IIF(x=a,1,0) as A, ;
FROM xTable, yTable, zTable, nTable ;
where loc=50 and grp=aa and .......
group by X into cursor MyCursor

Answer : Question on how deep can I go with the IIF()

I don't like IIF to go beyond 1. You can check out the ICASE function too.

The example you have given is not a nested IIF but a complex condition. There should not be any real limit on that.
Random Solutions  
 
programming4us programming4us