简体   繁体   English

可以在MS-Access中进行3表连接吗?

[英]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. 我尝试在Access中进行3表连接,但它不起作用。 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. 在MS-Access / Jet中允许使用其他SQL风格的所有各种类型的多表连接。 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? 或者你想知道如何使用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: 但它适用于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? Access可以进行大多数类型的连接(除了完整的外部)我想知道你的3表连接,如果你做一个模糊的外连接? Have a look at this KB article for an explanation 看看这篇知识库文章的解释

support.microsoft.com/kb/124937 support.microsoft.com/kb/124937

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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