RE: Query SUM help

2010-09-09 Thread Travis Ard
MySQL doesn't have the windowing functions that some other databases provide, but you can probably achieve the same effect with a couple user-defined variables: select teams_id as my_teams_id ,sum(rating) as total_team_rating from (select players.teams_id ,players.players_id

Re: Query SUM help

2010-09-09 Thread Ananda Kumar
try using the RANK function... something like select * from table order by RANK desc limit 11.this will get u the top 11 rows. regards anandkl On Thu, Sep 9, 2010 at 1:55 PM, Tompkins Neil wrote: > Yes, but it doesn't work. Basically I want the SUM(players_master.rating) > only to SUM the

Re: Query SUM help

2010-09-09 Thread Tompkins Neil
Yes, but it doesn't work. Basically I want the SUM(players_master.rating) only to SUM the top 11 players from each team. Any suggestions ? Cheers Neil On Thu, Sep 9, 2010 at 9:17 AM, Ananda Kumar wrote: > did u try to use LIMIT after ORDER BY > > > On Thu, Sep 9, 2010 at 1:27 PM, Tompkins Ne

Re: Query SUM help

2010-09-09 Thread Ananda Kumar
did u try to use LIMIT after ORDER BY On Thu, Sep 9, 2010 at 1:27 PM, Tompkins Neil wrote: > Any help would be really appreciated ? > > > > -- Forwarded message -- > From: Tompkins Neil > Date: Wed, Sep 8, 2010 at 5:30 PM > Subject: Query SUM help > To: "[MySQL]" > > > Hi > > I