SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

dougancil
Posting Yak Master

USA
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

Doug

RickD
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

dougancil
Posting Yak Master

USA
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  
 New 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.08 seconds. Powered By: Snitz Forums 2000