Im looking for a way to group and add up scores in mysql
Table would be something like this:
Name | Score |
---|---|
Gary | 50 |
Rob | 62 |
Bill | 42 |
Rob | 34 |
Gary | 24 |
Gary | 35 |
To Produce :
Name | Total Score |
---|---|
Bill | 42 |
Rob | 96 |
Gary | 109 |
Total Score being in descending order
CodePudding user response:
Try with below:
SELECT sum(Score) as total,Name FROM youtable GROUP BY Name ORDER BY total