【发布时间】:2014-06-27 16:19:44
【问题描述】:
如果 or 语句中的两个值都不为 null,会发生什么?
mysql每次都用左边还是有可能mysql用右边?
SELECT *
FROM posts p
WHERE parent_id = ? OR id = ?
ORDER BY date
DESC LIMIT 1
【问题讨论】:
-
mysql当然会用右边。为什么不?只有在根本没有匹配的 parent_id 时才检查 id 吗?
标签: mysql operators or-operator