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.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Incorrect Syntax
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

217 Posts

Posted - 11/11/2010 :  10:53:26  Show Profile  Send dougancil a Yahoo! Message  Reply with Quote
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

United Kingdom
3608 Posts

Posted - 11/11/2010 :  11:32:00  Show Profile  Reply with Quote
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 - 11/12/2010 :  11:57:02  Show Profile  Send dougancil a Yahoo! Message  Reply with Quote
thanks Rick.

That's what I was missing.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000