Help with Oracle query - to find a set of rows that don't meet specific conditions across tables
Posted on 2012-08-13
I have two tables, say tableA and tableB (tableB is via a dblink on a different server).
first we want to restrict our query to those rows on tableA that have condition='a'
then from this list, find the rows that DO NOT meet the following:
condition colx coly colz
a 1 2 3
a 4 5 6
b 7 8 9
c 10 11 12
a 13 14 15
colx coly colz
1 2 3
4 5 X
7 X 9
X 11 12
13 X 15
so the rows we want are the ones on tableA has 4 5 6 and 13 14 15 because colz on tableA does not match colz on tableB
We don't care about the mismatches 7 X 9 and X 11 12 because tableA does not have an 'a' in the condition column.
Any help would be much appreciated (and I can elaborate on this if required - I've tried to keep it simple to demonstrate the principle of what I'm trying to do)
DB is Oracle10G and I'm using sql developer to run any queries.