Your adjustment will filter out any nulls that would have otherwise been in the output.  The issue was not NULLs in the output (there was nothing in the output), but NULLs in the subquery in the NOT IN clause.  You could address this by filtering inside the subquery:<p><pre><code>    SELECT * FROM bar WHERE foo NOT IN (SELECT foo FROM tabl WHERE foo IS NOT NULL)

</code></pre>
Making this a little more realistic:<p><pre><code>    SELECT * FROM activation_code
    WHERE code NOT IN (
        SELECT activation_code_used FROM user
    );
</code></pre>
If that query was previously returning many rows, I contend that many people would not expect it to start returning zero rows just because a user was created without using an activation code.