finding unique records among 8 different tables

Gunit

Registered User.
Local time
Yesterday, 22:12
Joined
Aug 29, 2004
Messages
32
Was wondering if someone could help me with finding the easiest way to join 8 different tables by a common field and finding unique records in each that aren't in any of the other 7 tables. Anyone know of an easy way to do this?
 
I don't know if you would call this easy, but this is the only way I can think of right now, and it only uses 3 tables. The complexity grows as you add tables:


SELECT Table6.TableAF
FROM (Table6 LEFT JOIN Table7 ON Table6.TableAF = Table7.TableBF) LEFT JOIN Table8 ON Table6.TableAF = Table8.TableCF
WHERE (((Table7.TableBF) Is Null) AND ((Table8.TableCF) Is Null))
UNION ALL
SELECT Table7.TableBF
FROM (Table7 LEFT JOIN Table6 ON Table7.TableBF = Table6.TableAF) LEFT JOIN Table8 ON Table7.TableBF = Table8.TableCF
WHERE (((Table6.TableAF) Is Null) AND ((Table8.TableCF) Is Null))
UNION ALL
SELECT Table8.TableCF
FROM (Table8 LEFT JOIN Table7 ON Table8.TableCF = Table7.TableBF) LEFT JOIN Table6 ON Table8.TableCF = Table6.TableAF
WHERE (((Table7.TableBF) Is Null) AND ((Table6.TableAF) Is Null))

HTH
 
I kinda figured I would get this answer. I was hoping someone might have a creative way of doing this without having to construct code.
 

Users who are viewing this thread

Back
Top Bottom