mysql 查询除了最后四条的所有数据

应该怎么写查询语句。。。而且不能删除最后四条数据。。。30个字好烦啊

select * from 表名 A limit 0,(select count(*) from 表名 ) -4;

select * from 表名 A limit 4,(select count(*) from 表名 ) order by id desc;

你可以排序,把最后四条排到最前面,然后用limit 4, n来查询其他结果

1.最后四条?如果没有某个字段的排序,那将毫无意义。
2.查询并不会修改数据,因此‘’不能删除最后四条数据‘’这句是多余的。
3.select * from 表名 where 字段 not in (select b.字段 from (select * from 表名 ORDER BY 字段 DESC limit 0,4) AS b) ORDER BY 字段 ASC;

先使用排序字段把后四条拍到前面,然后再用limit进行取值

select * from 表名 A limit 0,(select count(*) from 表名 ) -4;