FMDB删除前50条数据的写法

删除前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 );

你可能感兴趣的:(OC)