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 newsid from tb_news order by newsid asc limit 10)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With