-4

What query should I use if I want a list of top goal scorers. Here is an SQLFiddle.

The result should be:

player_id | goals
1           5
2           2
3           1
Jonathan
  • 3,016
  • 9
  • 43
  • 74

1 Answers1

4
SELECT player_id, sum(goals) goals 
FROM goal GROUP BY player_id 
ORDER BY goals desc;

will help you.

cdaiga
  • 4,861
  • 3
  • 22
  • 42
ssamuel
  • 287
  • 2
  • 7