Del,
You're missing comma after previous column and I would use BETWEEN operator for readability. I made corrections below in the code.
>I am converting a VFP SELECT-SQL statement to operate on a SQL Server table. Below is an attempt and there's something wrong with the last SUM(), I think ...
>
>
>SELECT cITEM,
> SUM(nGOODLBS) AS qcItemGood,
> SUM(nSCRAPLBS) AS qnItemScrap,
> SUM(CASE cPCODE
> WHEN '100' THEN nTIMEINT
> ELSE 00.00
END) AS qnItemRun,
SUM(CASE WHEN cPCODE BETWEEN '101' AND '199' THEN nTIMEINT
> ELSE 00.00
> END) AS qnItemDown
>FROM EXTRMAST
> JOIN EXTRDETL
> ON EXTRMAST.EXTRMASTID = EXTRDETL.EXTRMASTID
>WHERE dSHIFTDATE BETWEEN '07/01/2004' AND '06/30/2005'
>GROUP BY cITEM
>ORDER BY 2 DESC
>
>
>In VFP, the last field expression was the following, so this may demonstrate further what I'm trying to accomplish.
>
>
>SUM(IIF(BETWEEN(cPCODE, '100', '199'), nTIMEINT, 00.00)) AS qnItemDown
>
>
>I'm looking at the BOL topic 'Conditional Data Processing Using Case' and it appears I have the case constructed as the second example, but perhaps doing this within a SUM is not allowed. How do I accomplish the VFP equivalent in SQL Server?
--sb--