Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Group and Sum rows with matching column

Status
Not open for further replies.

jase2006

Technical User
Nov 17, 2006
53
0
0
GB
Hi, currently trying to group all the rows with a column containing matching dates and sum all the rest of the columns together. Can anyone suggest a good SQL sample to do this. The Data looks like this:

Currently:
24/08/07 7 1 2 2
24/08/07 8 2 1 1
21/08/07 3 2 1 1

I want:
24/08/07 15 3 3 3 <- grouped and summed
21/08/07 3 2 1 1


 
Code:
select foodate
     , sum(foocol1) as total_col1
     , sum(foocol2) as total_col2
     , ...
  from daTable
group
    by foodate


r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top