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
 General SQL Server Forums
 New to SQL Server Programming
 Direction Need

Author  Topic 

DWMelton
Starting Member

5 Posts

Posted - 2012-07-06 : 15:33:31
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

38200 Posts

Posted - 2012-07-06 : 15:46:24
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

52326 Posts

Posted - 2012-07-06 : 16:55:21
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

5 Posts

Posted - 2012-07-10 : 21:53:38
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

52326 Posts

Posted - 2012-07-10 : 22:09:14
wc

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

Go to Top of Page
   

- Advertisement -