I have the following query:SELECT[ScratchPad5].EmployeeNumber, SUM CASE WHEN code in ('Vacation','Holiday','Sicktime', 'ETO') THEN 0 ELSE CASE WHEN code < 40 THEN code ELSE 40 END END) AS TotalRegHours, SUM CASE WHEN code in ('Vacation','Holiday','Sicktime', 'ETO') THEN 0 ELSE CASE WHEN code < 40 THEN 0 ELSE code - 40 END END) AS TotalOT, Sum(CASE WHEN 'Vacation' = code THEN [sumhours] END) AS Vacation, Sum(CASE WHEN 'Holiday' = code THEN [sumhours] END) AS Holiday, Sum(CASE WHEN 'Sicktime' = code THEN [sumhours] END) AS Sicktime, Sum(CASE WHEN 'ETO' = code THEN [sumhours] END) AS ETO FROM ScratchPad5 GROUP BY [ScratchPad5].EmployeeNumber ORDER BY [ScratchPad5].EmployeeNumber
and I'm getting an incorrect syntax error Server: Msg 156, Level 15, State 1, Line 2Incorrect syntax near the keyword 'CASE'.I'm sure I'm missing something small. Can someone else tell me what it may be?Thank youDoug