ISO: sql technique to select information from more than one table

From: Larry W. Virden <>
Date: Mon, 9 Mar 2009 11:37:57 -0700 (PDT)
Message-ID: <>

I have the following set of tables and columns



Key2 (that is to say - the values here are the same "things" as table 2's key2)

Key1 (values match T1.Key1)
Key2 (values match T2.Key2 and T3.Key2)

T4 maps the keys from one set of data to another. There should be rows containing all the keys.

T1 is in my case the master list of names. I want to find out if there are any rows in t1 where the person references also appears in t2 or t3, but with a different name column value.

For examine, the person may be Thomas in t1, Tom in t2 and Tommy in t3.

If the person's key is in t2, but no name is listed, I want to find that as well.

I tried something to the effect of

select,t1.dept,,t2.dept,, t3.dept from t1, t2, t3
where t1.key1 in (select key1 from t4) and

           ( (t2.key2 in (select key2 from t4 where key1 = t1.key1 and != or

             (t3.key2 in (select key2 from t4 where key1 = t1.key1 and !=


however, the resulting column values are not what I am expected.

I have fiddled with the where clause a bit after reading several web pages about solving this kind of problem, and the above is where I am at now - still unsuccessful.

Does anyone have a suggestion for fixing the select so that it does what I am trying for - I want to see the names (and departments) where the rows should match, but are not matching. Received on Mon Mar 09 2009 - 13:37:57 CDT

Original text of this message