Bug #2096 | not in with subselect not working as expected with null | ||
---|---|---|---|
Submitted: | 11 Dec 2003 7:38 | Modified: | 17 Dec 2003 21:23 |
Reporter: | [ name withheld ] | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 4.1 | OS: | Linux (Linux) |
Assigned to: | Alexey Botchkov | CPU Architecture: | Any |
[11 Dec 2003 7:38]
[ name withheld ]
[11 Dec 2003 8:41]
Dean Ellis
Verified against current 4.1.2 development sources. Thank you.
[17 Dec 2003 21:23]
Alexey Botchkov
It's actually the expected behaviour. NOT IN subquery will return NULL if there are NULL-s in subquery's results and no matches. And NULL in WHERE condition works like FALSE. You can use slightly modified query to get results you want: SELECT * FROM null_test_2 WHERE col2 NOT IN (SELECT col2 FROM null_test_1 WHERE col2 IS NOT NULL);