zisis
zisis

Reputation: 35

Compare value with integer sqlite

Here is my database structure: http://prntscr.com/63ftac

I'm trying to make a select query:

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

But I get a syntax error:

 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

Upvotes: 0

Views: 888

Answers (3)

Piotr Wittchen
Piotr Wittchen

Reputation: 3922

Your syntax seems to be incorrect. When you want to include more than one condition in WHERE clause, use AND keyword like here:

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

Upvotes: 1

Giru Bhai
Giru Bhai

Reputation: 14398

Becuase you missed AND between conditions,So rewrite as

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

Upvotes: 1

gvlasov
gvlasov

Reputation: 20015

You missed AND:

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

Upvotes: 1

Related Questions