I have the following data set:
Worker | Hours |
---|---|
Johnny | 8 |
Johnny | 7 |
Johnny | 4 |
Liz | 7 |
Liz | 2 |
Sally | 9 |
Sally | 9 |
Sally | 3 |
I need a SQL Select statement to sum the results for each distinct person. Ideally my results would look like the following:
Worker | Hours |
---|---|
Johnny | 19 |
Liz | 9 |
Sally | 21 |
I'm able to do this in SQL by looping through the data set, but for this problem I'm constrained to a single SELECT statement. Thanks in advance.