MySQL Forums :: General :: Top n Scores


Advanced Search

Top n Scores
Posted by: Chris Williams ()
Date: August 08, 2009 01:06PM

I know this is old and has been discussed, but a) I can't find a resolution, and b) I'm stumped.

I have a table: name (varchar), points (int). It is the result of a complex query, and so, yes, it's ordered. It has duplicates on name, points, maybe both, e.g.:

Fred 50
Fred 30
Fred 20
Fred 10
Fred 5
Barney 15
Barney 15
Barney 10
Barney 5
...

And so on. I need to get the top n scores for each name -- e.g. if n=2 that would be:

Fred 50
Fred 30
Barney 15
Barney 15
...

Yes, I'll be doing sums and such, but that's the easy part. Any help, ideas?

Thanks

Options: ReplyQuote


Subject Written By Posted
Top n Scores Chris Williams 08/08/2009 01:06PM
Re: Top n Scores Peter Brawley 08/09/2009 04:20AM
Re: Top n Scores Chris Williams 08/09/2009 10:55AM
Re: Top n Scores Peter Brawley 08/09/2009 05:56PM
Re: Top n Scores Chris Williams 08/09/2009 10:21PM
Re: Top n Scores Peter Brawley 08/10/2009 09:50AM
Re: Top n Scores Chris Williams 08/10/2009 11:13AM
Re: Top n Scores Peter Brawley 08/10/2009 01:09PM
Re: Top n Scores Chris Williams 08/11/2009 09:15AM
Re: Top n Scores Peter Brawley 08/11/2009 10:38AM
Re: Top n Scores Chris Williams 08/11/2009 12:34PM
Re: Top n Scores Peter Brawley 08/11/2009 01:35PM
Re: Top n Scores Chris Williams 08/11/2009 10:04PM
Re: Top n Scores Jay Alverson 08/21/2009 12:20PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.