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
Based on the other answer,
This assumes that
UserIDis a unique/primary key field. If it’s not, you could do something like this:Putting the spaces in because I know I’ve had to do similar on Oracle, not sure how MySQL would handle it without.