I have an SQLite database that I need to do the following: Keep only last N records, sorted by date. How do you do that?
To delete all but the latest 10 records.
delete from test where id not in ( select id from test order by date desc limit 10 )
2.1m questions
2.1m answers
60 comments
57.0k users