Question

My question is quite straightforward. I have a table, with, lets say x rows, with each an id, but I don't know how many rows I have. Now I want to delete the last row of my table for some reason... Is there an easy way to do that in android? I have been trying to use the last_insert_rowid in my where clause...but no luck so far... Any idea to do that with the sqlite database tools of android?

Was it helpful?

Solution

I assume that last_insert_rowid means that you are talking about db.

DELETE FROM test WHERE id = (SELECT MAX(id) FROM test);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top