Connecting Tech Pros Worldwide Forums | Help | Site Map

full outer join on two tables

Cory
Guest
 
Posts: n/a
#1: Nov 13 '05
i have two tables, Event1 and Event2.
They both have fields called contactID and eventID in them.
Some of the contactID's between the tables are equal and some are not.
I want to do a full outer join on contactID so i can get all the
contactID's in the query.

i know access doesn't support full outer joins so there must be a way to
do it without using one.

how do you do it in access 2000?

thanks in advance,

Cory

Alan Webb
Guest
 
Posts: n/a
#2: Nov 13 '05

re: full outer join on two tables


Cory,
Create a union of a left and a right join, so:
SELECT ACTIVE_EVENT.CONTACTID, ACTIVE_EVENT.EVENTID
FROM EVENT1 AS ACTIVE_EVENT
LEFT JOIN EVENT2 AS CLOSED_EVENT
ON ACTIVE_EVENT.CONTACTD = CLOSED_EVENT.CONTACTID
AND ACTIVE_EVENT.EVENTID = CLOSED_EVENT.EVENTID
UNION
SELECT CLOSED_EVENT.CONTACTID, CLOSED_EVENT.EVENTID
FROM EVENT1 AS ACTIVE_EVENT
RIGHT JOIN EVENT2 AS CLOSED_EVENT
ON ACTIVE_EVENT.CONTACTD = CLOSED_EVENT.CONTACTID
AND ACTIVE_EVENT.EVENTID = CLOSED_EVENT.EVENTID

"Cory" <no@no.com> wrote in message
news:1WPsc.4017$FN.420640@news02.tsnz.net...[color=blue]
> i have two tables, Event1 and Event2.
> They both have fields called contactID and eventID in them.
> Some of the contactID's between the tables are equal and some are not.
> I want to do a full outer join on contactID so i can get all the
> contactID's in the query.
>
> i know access doesn't support full outer joins so there must be a way to
> do it without using one.
>
> how do you do it in access 2000?
>
> thanks in advance,
>
> Cory[/color]


Bob Quintal
Guest
 
Posts: n/a
#3: Nov 13 '05

re: full outer join on two tables


Cory <no@no.com> wrote in
news:1WPsc.4017$FN.420640@news02.tsnz.net:
[color=blue]
> i have two tables, Event1 and Event2.
> They both have fields called contactID and eventID in them.
> Some of the contactID's between the tables are equal and some
> are not. I want to do a full outer join on contactID so i can
> get all the contactID's in the query.
>
> i know access doesn't support full outer joins so there must
> be a way to do it without using one.
>
> how do you do it in access 2000?
>
> thanks in advance,
>
> Cory
>[/color]

I create a union query for the desired field from each table, and
then left outer join that table back to each source.

Bob Quintal
Closed Thread


Similar Microsoft Access / VBA bytes