" + "=" + 3 + "<" + ...">

Sqlite Request Validation - Less and More

return mDb.query(DATABASE_TABLE, new String[] { KEY_ROWID, KEY_LEVEL }, KEY_LEVEL + ">" + "=" + 3 + "<" + 5, null, null, null, null); 

What am I doing wrong. He returns to all levels above and is equal to level 3, but not less than 5. I tried && | etc.

+3
source share
2 answers
 KEY_LEVEL + ">" + "=" + 3 + "<" + 5 

means

 KEY_LEVEL + ">=3<5" 

Use this instead:

 KEY_LEVEL + ">= 3 AND " + KEY_LEVEL + " < 5" 
+8
source

Compare KEY_LEVEL with 3 and compare KEY_LEVEL with 5 with the union of two expressions. I have never seen SQL use && or || Operators use AND and OR.

+1
source

Source: https://habr.com/ru/post/1498492/


All Articles