Need to do a full outer join

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there,

I can do a left and right outer join but there is no option in access to do
a full outer join.
Is that possible in access?

Any help will be greatly appreciated.

Suzan
 
hi,

You would create a UNION query, combining the results from multiple queries,
as OUTER JOIN is not allowed in Access. To create a pseudo OUTER JOIN, you
could try something like:

SELECT Employees.LastName, Employees.City, Suppliers.CompanyName,
Suppliers.City
FROM Employees INNER JOIN Suppliers ON Employees.City = Suppliers.City
UNION ALL
SELECT Employees.LastName, Employees.City, Suppliers.CompanyName,
Suppliers.City
FROM Employees LEFT JOIN Suppliers ON Employees.City = Suppliers.City
WHERE (((Suppliers.City) Is Null))
UNION ALL
SELECT Employees.LastName, Employees.City, Suppliers.CompanyName,
Suppliers.City
FROM Employees RIGHT JOIN Suppliers ON Employees.City = Suppliers.City
WHERE Employees.City is null;

In this example, the first query is an INNER JOIN. The second is a LEFT
JOIN, and the last query is a RIGHT JOIN. You could use this in practice
with your own query.

Hope this helps,
geebee
 
that works

Thanks


geebee said:
hi,

You would create a UNION query, combining the results from multiple queries,
as OUTER JOIN is not allowed in Access. To create a pseudo OUTER JOIN, you
could try something like:

SELECT Employees.LastName, Employees.City, Suppliers.CompanyName,
Suppliers.City
FROM Employees INNER JOIN Suppliers ON Employees.City = Suppliers.City
UNION ALL
SELECT Employees.LastName, Employees.City, Suppliers.CompanyName,
Suppliers.City
FROM Employees LEFT JOIN Suppliers ON Employees.City = Suppliers.City
WHERE (((Suppliers.City) Is Null))
UNION ALL
SELECT Employees.LastName, Employees.City, Suppliers.CompanyName,
Suppliers.City
FROM Employees RIGHT JOIN Suppliers ON Employees.City = Suppliers.City
WHERE Employees.City is null;

In this example, the first query is an INNER JOIN. The second is a LEFT
JOIN, and the last query is a RIGHT JOIN. You could use this in practice
with your own query.

Hope this helps,
geebee
 
Hi,


Removing the first inner join, and, in the first outer join, removing the
where clause, would also work, and the new solution would then be with one
less join (so probably faster).


Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top