3 ms·
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)
by dllthomas 11y ago
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:
SELECT * FROM bar WHERE foo NOT IN (SELECT foo FROM tabl WHERE foo IS NOT NULL)
Making this a little more realistic:
SELECT * FROM activation_code
WHERE code NOT IN (
SELECT activation_code_used FROM user
);
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.
- mirimir 11y agoThanks. I am sometimes just so perfectly assbackwards, and so blind to it ;)