Caused by: android.database.sqlite.SQLiteException: near "FROM": syntax error (code 1): , while compiling: SELECT _id, FROM TRACKS WERE _id=9
String test = "SELECT _id, FROM TRACKS WERE _id="+"9";
Cursor cursor = database.rawQuery(test, null);
没看到点:(任何帮助
我的声明中可能存在错误但无效
答案 0 :(得分:2)
SELECT _id,FROM TRACKS WERE _id =" +" 9"
'呈'应该是WHERE
答案 1 :(得分:2)
id
和WERE
之后的逗号不应为WHERE
。
还要考虑将[rawQuery()](http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#rawQuery(java.lang.String,java.lang.String [],android.os.CancellationSignal)]与selectionArgs
一起使用,以避免像{{{1}中那样连接查询和值。 1}}。