My original query returns 7975 rows. Adding a where clause, I receive 7917 rows. I want to SELECT the 58 row difference. In an effort to do so, I wrote what I believe to be the inverse where clause. Unfortunetly, I only see 41 rows, instead of the expected 58.
Both TableName.Column and TableName.Column2 are nullable.
Original Where
where ((TableName.Column in ('1', '2', '3))
or (TableName.Column2 in ('1', '2', '3))
My attempt at an inverse
where ((TableName.Column not in ('1', '2', '3))
and (TableName.Column2 not in ('1', '2', '3))
Your problem is with NULLs. The real inverse is either:
or:
With both columns, this would be: