Try:

SELECT SUM(goals) AS leaders
FROM stats
GROUP BY [player_field]
ORDER BY leaders DESC

--jeff

----- Original Message -----
From: "Alex Behrens" <[EMAIL PROTECTED]>
To: "MYSQL" <[EMAIL PROTECTED]>
Sent: Tuesday, April 30, 2002 6:55 PM
Subject: select by total goals


> hey guys,
>
> I'm working on a script to display the season leading scorers for my
> lacrosse site and I don't know how to do the query.
>
> I am trying to display the leaders scorers by total goals throughout the
> season, however I don't know how to select the sum of goals by each
> individual player then sort by amount of goals.
>
> how do i do this?
>
> I thought: select SUM(goals) AS leaders from stats ORDER BY number DESC;
>
> but that just takes the total amount of goals from the table, how do I add
> up individual goals (for each player) then sort by amount?
>
> Thanks!
> --------------------------------------------
> -Alex "Big Al" Behrens
> E-mail: [EMAIL PROTECTED]
> Urgent E-mail: [EMAIL PROTECTED] (Please be brief!)
> Phone: 651-482-8779
> Cell: 651-329-4187
> Fax: 651-482-1391
> ICQ: 3969599
> Owner of the 3D-Unlimited Network:
> http://www.3d-unlimited.com
> Send News:
> [EMAIL PROTECTED]
>
>
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to