我在下面的代码中遇到android.database.sqlite.SQLiteException: near "where": syntax error (code 1):
异常。我哪里出错了?
String selectQuery = "SELECT * FROM " + TABLE_VIDEO + " order by " + KEY_TIMESTAMP + " ASC "+"where " + KEY_TYPE + "='trending'";
答案 0 :(得分:3)
ORDER BY
必须是查询中的最后 SQL子句
因此,在
答案 1 :(得分:1)
ORDER BY
必须在WHERE
声明中SELECT
之后。
有关详细信息,请参阅here。
答案 2 :(得分:-1)
可能是:
/*code*/+ " ASC "+"where "+ /*morecode*/
尝试:
/*code*/+ " ASC WHERE "+ /*morecode*/