I have a table for saving the ranking of my app with the following fields: [id,username,score]
and I want to clean the table keeping only the top 100 entries.
How can I do this delete? I've tried DELETE FROM ranking ORDER BY score DESC LIMIT 100,999999999)
but it returns an error:
Error: near "ORDER": syntax error
Other alternative I've considered is:
DELETE FROM ranking WHERE id NOT IN (SELECT id FROM ranking ORDER BY score
DESC LIMIT 100)
but I dont know if it is efficient enought