>I need to take VFP code and create a SP to do likewise. It's a cross tab so this is what I have currently:
>SUM(IIF(ds_progedd.dbo.Demos.strata=2
>and type ='IMMU',1,0)) AS standard_immu ,
>
>How do you Case on 2 columns
>SUM(caseds_progedd.dbo.Demos.strata when 2
>and type when 'IMMU' then 1 else 0) AS standard_immu ,
>
>TIA
>
>__Stephen
You can use the CASE for this:
select sum(
case
when {condition} then {first choice} else {second choice} end)
as {column name} from {tablename}
Dan LeClair
www.cyberwombat.comSET RANT ON - The Wombat BlogLife isn’t a morality contest and purity makes a poor shield. - J. Peter MulhernDisclaimer: The comments made here are only my OPINIONS on various aspects of VFP, SQL Server, VS.NET, systems development, or life in general, and my OPINIONS should not be construed to be the authoritative word on any subject. No warranties or degrees of veracity are expressed or implied. Void where prohibited. Side effects may included dizziness, spontaneous combustion, or unexplainable cravings for dark beer. Wash with like colors only, serve immediately for best flavor.