Reputation: 51
I have 4 columns of info.
Team Name GameID TYPE Total
Santa Rosa 71 A 15
CN 71 A 17
CN 83 B 22
CN 83 C 5
Santa Rosa 72 D 87
I want to group by GameID, Team Name, then sum total, but I want to list Type like this: A,B,C
for Query, I am able to Sum(total), then group by team name, game id......but only returns 1 "Type" value.
Upvotes: 0
Views: 60
Reputation: 57593
One thing you can do (if it's ok for you) is this
SELECT GameID, `Team name`, SUM(Total) AS tot, GROUP_CONCAT(`TYPE`) AS types
FROM your_table
GROUP BY GameID, `Team name`
Upvotes: 1