作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要在 userID=4
和 status=“正在使用”、“待处理”或“已删除”时获取数据。但我得到了额外的数据,不知道为什么。
我从
获取额外数据userid=3
MySQL 查询是:
SELECT * FROM `registered_bicycle`
WHERE (`userID`='4')
AND (`status`='In Use')
OR (`status`='Pending')
OR (`status`='Deleted')
最佳答案
您必须在 OR
语句周围使用 (...)
:
SELECT * FROM `registered_bicycle`
WHERE (`userID`='4')
AND (`status`='In Use'
OR `status`='Pending'
OR `status`='Deleted')
或使用IN
函数
关于mysql - 多个 AND/OR 逻辑困惑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39012368/
我是一名优秀的程序员,十分优秀!