If I use the statement
SELECT * FROM dump WHERE (x_orig IS NOT NULL) OR (x_dest IS NOT NULL);
It does not filter out the null values in the columns I indicate. But when I use the statement
SELECT * FROM dump WHERE (x_orig IS NULL) OR (x_dest IS NULL);
It does filter out the results I actually want to remove.
I try to remove all the rows that have null values in the x coordinate of their origin or destination.
2
Answers
Does the
OR
in your original statement not just need to becomeAND
?SELECT * FROM dump WHERE (x_orig IS NOT NULL) AND (x_dest IS NOT NULL);
Then you are selecting all entries where both fields are non-null
By De Morgan’s laws if you want to negate (A OR B) you need to change it to (!A AND !B) instead of (!A OR !B).