Please start any new threads on our new 
    site at https://forums.sqlteam.com.  We've got lots of great SQL Server
    experts to answer whatever question you can come up with.
    
        | 
                
                    | 
                            
                                | Author | Topic |  
                                    | dougancilPosting 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 RegHoursFROM ScratchPad5GROUP BY [ScratchPad5].EmployeeNumberand 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 youDoug |  |  
                                    | RickDSlow 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 |  
                                          |  |  |  
                                    | dougancilPosting Yak  Master
 
 
                                    217 Posts | 
                                        
                                          |  Posted - 2010-11-12 : 11:57:02 
 |  
                                          | thanks Rick.That's what I was missing. |  
                                          |  |  |  
                                |  |  |  |