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  | 
                             
                            
                                    | 
                                         tarun_kumar07 
                                        Starting Member 
                                         
                                        
                                        4 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2013-12-13 : 03:06:43
                                            
  | 
                                             
                                            
                                            | Hi,I have 3 columns in my table as EmpId, DeptId and Salary.Consider the following data in table:EmpId  DeptId  Salarya       1       100b       1       200c       2       300d       3       400e       2       500Now i want to have Sum of Salary Dept wise without using Group By clause.Please help out. | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     khtan 
                                    In (Som, Ni, Yak) 
                                     
                                    
                                    17689 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2013-12-13 : 03:19:21
                                          
  | 
                                         
                                        
                                          [code]sum(Salary) over (partition by DeptId)[/code] KH[spoiler]Time is always against us[/spoiler]  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     tarun_kumar07 
                                    Starting Member 
                                     
                                    
                                    4 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2013-12-13 : 04:32:36
                                          
  | 
                                         
                                        
                                          | Thanks Khtan!  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |