DB - Oracle and MSSQL
How do I get A difference B ? A is what I need - but if a similar record exists in B , don't show it . Similar here means 2 columns are same . [This makes it unique btw] All that I know about A and B is that there is a 2 column combination is UNIQUE record . Say Country and City in the below example . It might have entirely different columns but one record per Country and City on which I need to do my diffence operation .
I have 2 tables , one that says here is the country and the city I am interested in .
A
Country City Population Dentiy
USA NewYork 10 mil
USA Nevada 1 mil
Usa Penn 3 mil
Another table that says "I have a list of surveyed Cities by some of our guys maybe if you have the data in this table you don't do anything , we will get it for you" .
B
Usa NewYork
SA Capetown
I want A difference B , i.e things that are there in A but not there B . And A might have other columns too ... If a Country City in A is there in B , I don't want that record . How do I achieve this ?
PS : The table A and B might be dynamically computer one's ! Using subquery , so I might use with A as and with B as ...
*A is a dynamically generated table , same with B * so I need to use suitable aliasings . The answer should assume this pre-condition .