I have three tables A, B, and C. Columns are Key1, Key1+Key2, and Key2 respectively. I want all C records that are not in B for A.Key1 = 'X' only. I am somewhat close but no cigar yet. Here is what I have so far.
SELECT C.Key2
FROM C LEFT OUTER JOIN
B ON C.Key2 = B.Key2
WHERE (NOT EXISTS
(SELECT B.Key2
FROM A INNER JOIN
B ON A.Key1 = B.Key1
WHERE C.Key2 = B.Key2 AND (A.Key1 = 'X')))
Thanks in advance,
vmon
SELECT C.Key2
FROM C LEFT OUTER JOIN
B ON C.Key2 = B.Key2
WHERE (NOT EXISTS
(SELECT B.Key2
FROM A INNER JOIN
B ON A.Key1 = B.Key1
WHERE C.Key2 = B.Key2 AND (A.Key1 = 'X')))
Thanks in advance,
vmon