Skip to content
Advertisement

How to Exclude Record Based on Multiple Fields where Records May Share Values

I have two tables of addresses. They are formatted very similarly, to [main] table also has the customer name

The shipto table has many addresses for each main customer, and many times the main addresses is also listed as a shipto. I do not want to include that main address in my results but I can’t get it to work correctly since in many cases the other addresses may share a city or state, or even a blank address2.

Here is what I have…

Here is the data:

MAIN

SHIPTO

I am expecting it to return id 2-5, but it’s only returning #5 because it’s matching some element of the main address to the shipto, but I need it to see the record as a whole.

I also tried adding an AND and parenthesis thinking that it would work, but that didn’t either.

Advertisement

Answer

Maybe try this query

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement