Reputation: 53
return mDb.query(DATABASE_TABLE, new String[] { KEY_ROWID,
KEY_LEVEL }, KEY_LEVEL + ">" + "=" + 3 + "<" + 5, null, null, null, null);
What am I doing wrong. It's returning all over above and equal to level 3 but not less than 5. I've tried && | and such.
Upvotes: 3
Views: 5291
Reputation: 22822
KEY_LEVEL + ">" + "=" + 3 + "<" + 5
translates as
KEY_LEVEL + ">=3<5"
Use that instead:
KEY_LEVEL + ">= 3 AND " + KEY_LEVEL + " < 5"
Upvotes: 8
Reputation: 342
Compare KEY_LEVEL to 3 and compare KEY_LEVEL to 5 with a conjunction of two expressions. I've never seen SQL use the && or || operators; use AND and OR.
Upvotes: 1