简体   繁体   English

Sqlite查询检查 - 小于和大于

[英]Sqlite query check - less than and greater than

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 && | 它会在上面返回并等于3级但不低于5.我已经尝试了&& | and such. 等等。

KEY_LEVEL + ">" + "=" + 3 + "<" + 5

translates as 翻译为

KEY_LEVEL + ">=3<5"

Use that instead: 使用它代替:

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

Compare KEY_LEVEL to 3 and compare KEY_LEVEL to 5 with a conjunction of two expressions. 将KEY_LEVEL与3进行比较,并将KEY_LEVEL与5与两个表达式的结合进行比较。 I've never seen SQL use the && or || 我从未见过SQL使用&&或|| operators; 运营商; use AND and OR. 使用AND和OR。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM