NYCPHP Meetup

[nycphp-talk] Need help understanding NULL

Daniel Convissor danielc at analysisandsolutions.com
Sat Aug 29 23:57:35 EDT 2009


Heya:

> In sql, every comparison to NULL, yields another NULL.
> That is why 'SELECT * WHERE foo = NULL' doesn't do what you might
> expect.  In fact that query is guaranteed to always return zero rows.

When you want to get rows where foo really is null, you need to need to 
use "is null":
    SELECT * WHERE foo IS NULL;

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409



More information about the talk mailing list