Selecting rows where a column is NULL

Post Reply
mister_v
Posts: 188
Joined: Thu Mar 04, 2010 9:19 pm

Selecting rows where a column is NULL

Post 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?
chris
Site Admin
Posts: 194
Joined: Mon Jul 21, 2008 9:52 am

Re: Selecting rows where a column is NULL

Post 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.
Post Reply