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.

 All Forums
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 Sum of Column without using Group By

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 Salary
a 1 100
b 1 200
c 2 300
d 3 400
e 2 500

Now 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]

Go to Top of Page

tarun_kumar07
Starting Member

4 Posts

Posted - 2013-12-13 : 04:32:36
Thanks Khtan!
Go to Top of Page
   

- Advertisement -