Results 1 to 3 of 3

Thread: SQL statement with sum()

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2002
    Location
    Canada
    Posts
    75

    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

  2. #2
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    Maybe try this:

    SELECT players, sum(points) As Sum FROM players GROUP BY player
    Last edited by abdul; Jul 28th, 2002 at 04:36 PM.
    Baaaaaaaaah

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2002
    Location
    Canada
    Posts
    75
    thanks alot, that got me to what i wanted.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width