'Full' outer join syntax

  • Thread starter Thread starter DOTJake
  • Start date Start date
D

DOTJake

What is the SQL sytax for doing a full outer join (all
rows from both tables)?

Thanks,
DOTJake
 
Hi,


SELECT a.*, b.* FROM a LEFT JOIN b ON a.f1=b.g1

UNION ALL

SELECT a.*, b.* FROM a RIGHT JOIN b ON a.f1=b.g1 WHERE a.f1 IS NULL




or, for "small tables":

make a table (or a saved query) out of

SELECT a.f1 FROM a UNION SELECT b.g1 FROM b

then,


SELECT a.*, b.*
FROM (tempTable LEFT JOIN a ON tempTable.f1 = a.f1)
LEFT JOIN b ON tempTable.f1=b.g1





Hoping it may help,
Vanderghast, Access MVP
 
Back
Top