SUM( CASE WHEN MYTABLE.STATUS IN('O','C') and MYTABLE.TYPE = 'AM' THEN 1 ELSE 0 END) as OPEN_PM
>
>I don't think SQL Server supports IIF() function. And I need to convert the following expression in my VFP-type SQL Select to SQL Server:
>
>
>sum( iif( ( MYTABLE.STATUS = "O" or MYTABLE.STATUS = "C" ) and MYTABLE.TYPE = "AM", 1, 0 )) as OPEN_PM
>
>
>How do I do it so that it works when passing the expression to SQL Server (via SPT)?
>
>P.S. I forgot to change the default version of SQL Server when creating this message. I am using SQL Server 2005.
>
>UPDATE/SOLUTION: CASE.
--sb--