FMDB删除前50条数据的写法

来源:互联网 发布:js获取标签的name属性 编辑:程序博客网 时间:2024/06/03 20:25

删除前50条数据

delete from tab where (select count(Id) from tab)> 50 and Id in (select Id from tab order by Id ASC limit 50);

换成相应的数量即可,若想删除50条之后的数据,用这个:

delete from tab where (select count(Id) from tab)> 50 and Id in (select Id from tab order by insertTime desc limit (select count(Id) from tab) offset 50 );
0 0
原创粉丝点击