标签: sqlite
我怎样才能删除sqlite中20日之后的所有行,换句话说我需要维护一个数据库,每个新插入时只需要20行我需要删除最旧的行插入
答案 0 :(得分:3)
DELETE FROM stuff WHERE rowid NOT IN ( SELECT rowid FROM stuff ORDER BY created DESC LIMIT 20);
请参阅http://sqlfiddle.com/#!7/a3e2f/9