我想删除带有偏移量的有限数量的行,但我只是设法删除了整个表。
我尝试了以下方法:
1. DELETE FROM tblname ORDER BY _id LIMIT N OFFSET M
2. DELETE FROM tblname WHERE `_id` IN (SELECT `_id` FROM tblname ORDER BY `_id` ASC LIMIT ? OFFSET ?)
第一个语句给出了一个已知错误:Error: Caused by: android.database.sqlite.SQLiteException: near "ORDER": syntax error: DELETE FROM tblname
The second statement wipes the entire table.
我做错了什么?什么是好的选择?
谢谢!
答案 0 :(得分:0)
DELETE语句中对ORDER和LIMIT的SQLite支持是可选的,可能不会内置到您正在使用的库中。见http://www.sqlite.org/lang_delete.html