Query - Trying to SUM one field based on content of another field

Posted by ShaneL on Stack Overflow See other posts from Stack Overflow or by ShaneL
Published on 2012-10-14T21:36:02Z Indexed on 2012/10/14 21:36 UTC
Read the original article Hit count: 182

Filed under:
|
|

Table:

DayOfWeek           Enrollments
Monday                 35
Monday                 12
Saturday               25
Tuesday                15
Monday                  9
Tuesday                15

Basically I'm trying to sum the total enrolments for each day.

so the Output will look like:

DayOfWeek           Enrollments
Monday                 56
Saturday               25
Tuesday                30

I've spent around 4 hours trying to work this out trying many many different ways but no luck.

The problem I'm having is i can count how many enrollments for each day but can't have it aligned with the correct day when i run the query e.g. I want The total to be on the same line as the day it was calculated from. (I hope that is clear enough)

© Stack Overflow or respective owner

Related posts about sql

Related posts about query