SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

tarun_kumar07
Starting Member

India
4 Posts

Posted - 12/13/2013 :  03:06:43  Show Profile  Reply with Quote
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)

Singapore
17431 Posts

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



KH
Time is always against us

Go to Top of Page

tarun_kumar07
Starting Member

India
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  
 New 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.03 seconds. Powered By: Snitz Forums 2000