看看这个并试试我的帮助,
由于
DELETE FROM table WHERE id < ((SELECT count(*) FROM table) - 10);
答案 0 :(得分:1)
要从表中删除除最后10行之外的所有行:
delete from mytable
where id < (select min(id) from (
select id
from mytable
order by id desc
limit 10) x)
请参阅SQLFiddle