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-03 : 17:48:35 
 |  
                                            | I am trying to do a sum for distinct names in a table using the following query:select name, employeenumber, ontime1, sum (ontime1) as totalminutesfrom scratchpad1where date between '5/1/2010' and '5/15/2010'group by name, employeenumber, ontime1and what I get back is as follows:Cametria Alexander	8451	.000000000	.000000000Cametria Alexander	8451	3.349950000	3.349950000Cametria Alexander	8451	3.447833333	3.447833333What I'm trying to do is to sum all the ontime1 entries for each day per name. What's the best way to do this?Thank youDoug |  |  
                                    | russellPyro-ma-ni-yak
 
 
                                    5072 Posts | 
                                        
                                          |  Posted - 2010-11-03 : 17:53:30 
 |  
                                          | [code]select	name, employeenumber, ontime1, sum (ontime1) as totalminutesfrom	scratchpad1where	date between '5/1/2010' and '5/15/2010'group by	name, employeenumber,ontime1[/code] |  
                                          |  |  |  
                                    | webfredMaster Smack Fu Yak Hacker
 
 
                                    8781 Posts | 
                                        
                                          |  Posted - 2010-11-04 : 04:07:14 
 |  
                                          | And delete the last comma too. No, you're never too old to Yak'n'Roll if you're too young to die.
 |  
                                          |  |  |  
                                    | madhivananPremature Yak Congratulator
 
 
                                    22864 Posts |  |  
                                    | dougancilPosting Yak  Master
 
 
                                    217 Posts | 
                                        
                                          |  Posted - 2010-11-04 : 10:50:04 
 |  
                                          | Thank you very much. That was it. |  
                                          |  |  |  
                                    | russellPyro-ma-ni-yak
 
 
                                    5072 Posts | 
                                        
                                          |  Posted - 2010-11-04 : 14:15:18 
 |  
                                          | Glad to help! |  
                                          |  |  |  
                                |  |  |  |