I have this table called, ACTIVITIES:
Name Activity Minutes
JOSE videogames 50
MARISSA videogames 50
TINA CHESS 90
JAKE CHESS 95
For each activity in the table, how do I make a count of how many persons did that activity? I would like to print the activity, the count, and the sum of the minutes in my query.
I tried working by parts & this was my attempt:
SELECT Distinct(Activity), count(Activity) as Total
FROM ACTIVITIES;
However, the query result gave me an error saying: "not a single-group group function"
GROUP BY Activity, and you don't needDISTINCT(Activity); so try this:SELECT Activity, count(Activity), sum(NUMOFMINUTES) FROM Activities GROUP BY Activity