3 ms·
> Then why on earth is NULL being treated the same as false for the purposes of a WHERE clause. Because, by definition, the WHERE clause returns a record when
by da_chicken 7y ago
> Then why on earth is NULL being treated the same as false for the purposes of a WHERE clause.
Because, by definition, the WHERE clause returns a record when it evaluates to TRUE. FALSE and UNKNOWN are not TRUE.
Second, you absolutely can do what you're trying to here, but not the way you've done it:
SELECT CASE WHEN bar = baz THEN 'foo' ELSE 'bar' END AS corge
FROM quux
You're asking the wrong question and wondering why you're getting the wrong answer.