Delete records not in top 15

Posted on 16th Feb 2014 by admin

Hi,

I'm creating a hall of fame page in my game and the page will only display the top 15 scores.
So I want to delete the scores that get bumped down the list.

How would I write the query to delete everything NOT in the top 15?

I've been trying different things, but nothing is working.
I thought maybe something like this, but it didn't work.
Line number On/Off | Expand/Contract $removeold = $db->execute("DELETE FROM `soundoff_hof` WHERE `id` NOT IN (SELECT `id` LIMIT 15 FROM `soundoff_hof`)");

am I close with something like this, or is there another method to do it?

Other forums