In Sqlite, can I know how to delete last 10 records? I\'ve wrote following coding but seems not working at all.
delete from tb_news where newsid = (SELECT ne
Did you tried?
delete from tb_news where newsid IN (SELECT newsid from tb_news order by newsid asc limit 20)
I don't know your table structure, but maybe, it should be DESC instead of ASC. I mean DESC will give you the biggest IDs (and so, the latest).
You can use
delete from tb_news where newsid IN
(SELECT newsid from tb_news order by newsid desc limit 10)
Change your SQL statement to the below.
delete from tb_news where newsid IN (SELECT newsid from tb_news order by newsid DESC limit 20)
Side note: sqllite may not support LIMIT in the sub query.