I can not build a query to mysql, to remove the lines from 200 to end.
DELETE FROM `popular`
WHERE NOT EXISTS(
SELECT *
FROM `popular`
ORDER BY `rank` DESC, `timestamp` DESC
LIMIT 200
)
Since an error – #1093 – You can’t specify target table ‘popular’ for update in FROM clause
Just split it into two calls: first run a select and find the ids of the lines you want to delete. then copy these ids and use them on the delete command.
if you don’t want to manually add commas between the IDs you can use “find and replace” in textpad or excel can do it really easy.