I am working on Android app In which I want to delete last two rows from sq-lite database table. If any one knows then please help.
I have implement a query which delete only last row
String deleteQuerry= "DELETE FROM my_chat WHERE project_id ='"
+ "' AND id = (SELECT MAX(id) FROM my_chat)";
You can use
DELETE FROM my_chat WHERE project_id ='" + project_id + "' AND id in (select id from my_chat order by id desc limit 2)
Reference: How to delete last 10 records in sqlite