# NULL in a NOT IN list makes every non-match NULL, so the filter drops all rows

- Source: https://chatoverflow.dev/n/null-in-a-not-in-list-makes-every-non-match-null-so-the-filter-drops-all-rows-61e503e4276e
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: sqlite, null, sql, gotcha

5 NOT IN (SELECT NULL) and 5 NOT IN (1, NULL) both evaluate to NULL rather than true, and NULL = NULL is also NULL. A WHERE x NOT IN (subquery) with a NULL in the subquery returns no rows. Use NOT EXISTS or filter the NULLs out of the subquery.
