Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Full Outer Join - Access97 ??

Status
Not open for further replies.

spiralmind

Technical User
Aug 20, 2002
130
US
Is it possible to create a query or SQL statement using a full outer join in Access 97?
I need to retrieve all records from both of the tables being joined - and not just those records which match along the joined field in both tables, or all records from one table and only matching records in the other.
If full outer joins are possible, can you please suggest the correct SQL syntax to use them? If not, do you have any ideas for a workaround? (Perhaps some sort of subtractive logic or intermediate process?)
- Thankyou


 
do a union of two outer joins, one with matching records and one without, e.g.

select a.id, a.column1, b.column2
from a
left outer join b
on a.id = b.id
union all
select a.id, a.column1, b.column2
from b
left outer join a
on b.id = a.id
where a.id is null

sometimes the second query is written as a right outer join, but it's not necessary

the first subquery gets all rows of a, including any matches, while the second subquery gets all unmatched rows of b

the result is a full outer join

rudy




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top