This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery
DELETE FROM tmp_debug WHERE Id NOT IN (SELECT Id FROM tmp_debug ORDER BY Id DESC LIMIT 2) -- DELETE FROM tmp_debug WHERE Id NOT IN (SELECT * FROM ((SELECT Id FROM tmp_debug ORDER BY Id DESC LIMIT 2)) AS t)