You cannot use "=" when comparing with NULL's. Replace "=" with "is" and you will get the results you are hoping for. Nothing ever equals NULL (in the sense that "=" implies). You can use "is" for even regular comparisons where "=" will work (like comparing non-null numbers), so I have gotten into the habit of simply using "is" wherever I would think of using "=".