sql boolean truth test: zero OR null
Posted
by
AK
on Stack Overflow
See other posts from Stack Overflow
or by AK
Published on 2011-02-18T20:17:26Z
Indexed on
2011/02/18
23:25 UTC
Read the original article
Hit count: 206
mysql
Is there way to test for both 0 and NULL with one equality operator?
I realize I could do this:
WHERE field = 0 OR field IS NULL
But my life would be a hundred times easier if this would work:
WHERE field IN (0, NULL)
(btw, why doesn't that work?)
I've also read about converting NULL to 0 in the SELECT statement (with COALESCE). The framework I'm using would also make this unpleasant.
Realize this is oddly specific, but is there any way to test for 0 and NULL with one WHERE predicate?
© Stack Overflow or respective owner