Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 Sum of Column without using Group By
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

4 Posts

Posted - 12/13/2013 :  03:06:43  Show Profile  Reply with Quote

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.

In (Som, Ni, Yak)

17689 Posts

Posted - 12/13/2013 :  03:19:21  Show Profile  Reply with Quote
sum(Salary) over (partition by DeptId)

Time is always against us

Go to Top of Page

Starting Member

4 Posts

Posted - 12/13/2013 :  04:32:36  Show Profile  Reply with Quote
Thanks Khtan!
Go to Top of Page
  Previous Topic Topic Next 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.02 seconds. Powered By: Snitz Forums 2000