开发者

Delete last row in a table android

开发者 https://www.devze.com 2022-12-30 13:02 出处:网络
My question is quite straightforward. I have a table, with, lets say x rows, with each an id, but I don\'t know how m开发者_开发知识库any rows I have. Now I want to delete the last row of my table for

My question is quite straightforward. I have a table, with, lets say x rows, with each an id, but I don't know how m开发者_开发知识库any 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?


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

DELETE FROM test WHERE id = (SELECT MAX(id) FROM test);
0

精彩评论

暂无评论...
验证码 换一张
取 消