简体   繁体   中英

Is it possible to do a 3 table join in MS-Access?

I try to do a 3-table join in Access and it will not work. Is it possible?

All the various types of multi-table joins that are available in other flavour of SQL are permitted in MS-Access/Jet. For example, here's a straight three-table hierarchical example (a bit more real-world than the other answers here):

SELECT
    x.FirstName,
    x.Surname,
    r.RegionName,
    c.CountryName
FROM
    (Customer x LEFT JOIN Region r
    ON r.ID=x.RegionID)
    LEFT JOIN Country c
    ON c.ID=r.CountryID

Or did you want to know how to do it using the Visual Designer in MS-Access?

I once had a problem when I tried

select
  x,
  y
from 
  A        inner join
  B on k=l inner join
  C on f=g

This didn't work. But it works with parantheses:

select
  x,
  y
from ( 
  A          inner join
  B on k=l ) inner join
  C on f=g

Yes, it's possible:

Select *
From A, B, C
Where A.a = B.b
And A.c = C.c

or

Select *
From A, B, C
Where A.a = B.b
And B.c = C.c

Access can do most types of joins (apart from a full outer) I wonder with your 3 table join if you are doing an ambiguous outer join? Have a look at this KB article for an explanation

support.microsoft.com/kb/124937

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM