前提是table表以id为主键切自增。 delete A from table A join (select id from table order by id desc limit n-1,1) B on A.id<B.id;