MySQL Forums
Forum List  »  General

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
August 08, 2009 01:06PM
August 09, 2009 04:20AM
August 09, 2009 10:55AM
August 09, 2009 05:56PM
August 09, 2009 10:21PM
August 10, 2009 09:50AM
August 10, 2009 11:13AM
August 10, 2009 01:09PM
August 11, 2009 09:15AM
August 11, 2009 10:38AM
August 11, 2009 12:34PM
August 11, 2009 01:35PM
August 11, 2009 10:04PM
August 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.