What happens if both values in an or statement are non-null?
Does mysql uses the left side every time or is there a possibility that mysql uses the right side?
SELECT *
FROM posts p
WHERE parent_id = ? OR id = ?
ORDER BY date
DESC LIMIT 1
What happens if both values in an or statement are non-null?
Does mysql uses the left side every time or is there a possibility that mysql uses the right side?
SELECT *
FROM posts p
WHERE parent_id = ? OR id = ?
ORDER BY date
DESC LIMIT 1
null
then the comparison with =
will fail. Use IS
instead.