Android.database.sqlite.sqliteexception: Near "order": Syntax Error (code 1): ,
I keep getting this error. I'm sure it's a simple syntax error. Does anyone see it? I been debugging for ~30min and can't seem to find it. query DELETE FROM SuccessfulCalls O
Solution 1:
ORDER BY
and LIMIT
are not syntactically allowed with a DELETE
query unless sqlite is built with SQLITE_ENABLE_UPDATE_DELETE_LIMIT
which is not the case on Android.
If you want to delete the two highest id
rows, use
DELETEFROM SuccessfullCalls WHERE id IN (SELECT id FROM SuccessfulCalls ORDERBY id DESC LIMIT 2);
Use execSQL()
for such queries and not rawQuery()
to get the SQL actually run.
Solution 2:
You cannot use ORDER BY in a DELETE statement. See http://www.sqlite.org/lang_delete.html
Post a Comment for "Android.database.sqlite.sqliteexception: Near "order": Syntax Error (code 1): ,"