Reputation: 10621
Ok I have a table with the following fields:
correct_id, player_id, reward
I want to create a list in descending order of who has had the most correct answers, how many questions they got right and what was the total reward they earned. How do I do it?
SELECT player_id, sum(correct_id), sum(reward) FROM questions_correct GROUP BY count(correct_id)
Upvotes: 1
Views: 98
Reputation: 29071
Try this:
SELECT player_id, COUNT(correct_id) CorrectAnsCnt, SUM(correct_id), SUM(reward)
FROM questions_correct
GROUP BY player_id
ORDER BY CorrectAnsCnt DESC
Upvotes: 1