MySQL: how to keep top 1000 rows for each value of a column

Posted by Patrick on Stack Overflow See other posts from Stack Overflow or by Patrick
Published on 2010-05-10T16:55:25Z Indexed on 2010/05/11 1:44 UTC
Read the original article Hit count: 239

Filed under:

hi,

I need some help with this query: I want to delete the following rows from my table. The table has 4 columns: UserID, UserName, Tag, Score.

I want to keep only the top 1000 users with highest score, for each Tag.

So I need to order by score, and to keep the first 1000 users for each tag.

Thanks

© Stack Overflow or respective owner

Related posts about mysql