View Full Version : Joining Queries where join requires matching/unmatching data from both tables


BigJimSlade
12-13-2000, 06:44 AM
Hey, Big Jim here...

I have table X and table Y

table X has column A, B, C, D
table Y has column E, F, G, H

If X.A = Y.E and X.B = Y.F, I would like to place ABCDEFGH on the same line. If these criteria are not met, I would like the data to still populate, just on seperate rows (ABCD or EFGH).

Anyone have an idea?

Thanks in advance

Big Jim

Pat Hartman
12-13-2000, 04:19 PM
You need a "full outer join" which Access does not support so you'll have to simulate one. It requires three queries. A left join of table X to table Y, a right join of table X to table Y, and a union of the two.

The left join pulls all the rows from table X and any matching data from table Y. The right join pulls all the rows from table Y and any matching data from table X. And, the union pulls the two recordsets into one and gets rid of the duplicates.

BigJimSlade
12-14-2000, 05:04 AM
Thank you for your help, Pat. I appreciate it and hope it can help others.

Happy YN
04-25-2002, 07:00 AM
no! I can join the fields normally but as soon as i try anouter join I get a message that the sql cannot be done due to ambiguous outer joins and I should first create a query with one join and then connect with that

I forgot to say that this field "month" contains duplicate values but There is another field which makes them unique and which I need to join aswell to the second table.
I know it sounds complicated but it isn't really
I will give more info if required to simplify the problem
thankx

Fornatian
04-25-2002, 08:19 AM
Happy YN is a little confused, I made reference to this post elsewhere.