-
SQL statement with sum()
could someone please help me with this...i'm not too sure how to address it here's an example of what i need to give you an idea.
say there 20 players, each playing whatever game/sport each day, a player can get any # of points in one day and i want to get a list (in order) of players listed by the highest total # of points.
to make it simple i have ID, player, date, points
getting the sum of 1 players points isnt difficult, but i dont have a clue how to orderly get each players total points...pleeease help me
SELECT sum(points) AS sum FROM players WHERE player="whoever";
will get one player's points, but i dont know how to get each and list them highest to lowest :(
-
Maybe try this:
SELECT players, sum(points) As Sum FROM players GROUP BY player
-
thanks alot, that got me to what i wanted.