skip to Main Content

If I use the statement

SELECT * FROM dump WHERE (x_orig IS NOT NULL) OR (x_dest IS NOT NULL);
Not null image result

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);
Null image result

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


  1. Does the OR in your original statement not just need to become AND?

    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

    Login or Signup to reply.
  2. 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).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search