将值与整数sqlite进行比较

时间:2015-02-10 17:09:29

标签: java android sqlite

这是我的数据库结构:http://prntscr.com/63ftac

我正在尝试进行选择查询:

SELECT * FROM QUESTIONS WHERE TEAM="Albania" UID!='2'  LIMIT 1

但是我收到语法错误:

 near "UID": syntax error
 ﹕ android.database.sqlite.SQLiteException:
near "UID": syntax error (code 1): , while compiling: SELECT * FROM QUESTIONS 
WHERE TEAM="Albania" UID!='2'  LIMIT 1

3 个答案:

答案 0 :(得分:1)

您错过了AND

SELECT * FROM QUESTIONS WHERE TEAM="Albania" AND UID!="2" LIMIT 1

答案 1 :(得分:1)

因为您在条件之间错过了AND,所以重写为

SELECT * FROM QUESTIONS WHERE TEAM="Albania" AND UID!='2'  LIMIT 1

答案 2 :(得分:1)

您的语法似乎不正确。如果要在WHERE子句中包含多个条件,请使用AND关键字,如下所示:

SELECT * FROM QUESTIONS WHERE TEAM="Albania" AND UID!='2'  LIMIT 1