this query returns the list below it, however the ids occur multiple times, can i group the ids and add up all the plays so i just get a list unique ids with the total number of plays next to it. is this possible in sql?
SELECT [fkPlayerId],[plays]
FROM [dPlaysPerDay]
INNER JOIN dWinners
ON [dPlaysPerDay].[fkPlayerId]=dWinners.[pkWinnerId]
53693 1
53695 1
53696 1
53693 1
53692 2
53698 2
53697 1
53699 2
53698 3
53693 6
53699 2
53693 2
53700 2
53698 1
When using
GROUP BY, all data items in theSELECT, must either be included in theGROUP BYor placed in an Aggregate Function.Therefore,
fkPlayerIdshould be grouped by, andplaysused with theSUM()functionTo
ORDER BYthe aggregate function, give the data item an alias, and Order by this: