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
 General SQL Server Forums
 New to SQL Server Programming
 Direction Need
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

DWMelton
Starting Member

USA
5 Posts

Posted - 07/06/2012 :  15:33:31  Show Profile  Reply with Quote
I have a query that joins multiple tables and the results are at the details level, now I need to sum the records based on 3 columns. Example, I execute the query and its results in 191 records returned (all detials), but I need it to return the summation of the 191 by type, group and name. Any suggestions and directions

tkizer
Almighty SQL Goddess

USA
35017 Posts

Posted - 07/06/2012 :  15:46:24  Show Profile  Visit tkizer's Homepage  Reply with Quote
We need some sample data in order to help.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
48037 Posts

Posted - 07/06/2012 :  16:55:21  Show Profile  Reply with Quote
with limited provided information, stub will look like

SELECT Col1,Col2,Col3,SUM(yourfield1),..
FROM table
GROUP BY Col1,Col2,Col3


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

DWMelton
Starting Member

USA
5 Posts

Posted - 07/10/2012 :  21:53:38  Show Profile  Reply with Quote
Thanks GB worked

quote:
Originally posted by DWMelton

I have a query that joins multiple tables and the results are at the details level, now I need to sum the records based on 3 columns. Example, I execute the query and its results in 191 records returned (all detials), but I need it to return the summation of the 191 by type, group and name. Any suggestions and directions

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
48037 Posts

Posted - 07/10/2012 :  22:09:14  Show Profile  Reply with Quote
wc

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

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