Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Incorrect Syntax

Author  Topic 

Posting Yak Master

217 Posts

Posted - 2010-11-11 : 10:53:26
I have the following query:

SELECT DISTINCT [ScratchPad5].EmployeeNumber, Sum([ScratchPad5].totaltime),
case when ([hours]>40,[hours]-40,0) AS ot, case when ([hours]>40,[hours]-[ot],[hours]) AS RegHours

FROM ScratchPad5

GROUP BY [ScratchPad5].EmployeeNumber

and when I try to parse it, I get an error that there is an incorrect syntax near the comma on line 1. Can someone please assist me?

Thank you


Slow But Sure Yak Herding Master

3608 Posts

Posted - 2010-11-11 : 11:32:00
case when [hours]>40 THEN [hours]-40 ELSE 0 END AS ot, case when [hours]>40 THEN [hours]-[ot] ELSE [hours] END AS RegHours
Go to Top of Page

Posting Yak Master

217 Posts

Posted - 2010-11-12 : 11:57:02
thanks Rick.

That's what I was missing.
Go to Top of Page

- Advertisement -