Page 1 of 1

Selecting rows where a column is NULL

Posted: Mon Aug 31, 2015 3:54 pm
by mister_v
I'm having a problem when I try to select the rows that have a NULL for a column.

Code: Select all

SELECT * FROM database WHERE column = NULL;
SELECT * FROM database WHERE column = 'NULL';
None is working...

What am I doing wrong?

Re: Selecting rows where a column is NULL

Posted: Mon Aug 31, 2015 5:41 pm
by chris
Null is special value, it is not a values, not "no value" nor false or true.
You can use IS

Code: Select all

SELECT * FROM database WHERE column IS NULL;
that should work.