如何使用内部/外部组合在 Access 中加入 4 个以上的表? [英] How do I join 4+ tables in Access with a combination inner/outer?

查看:62
本文介绍了如何使用内部/外部组合在 Access 中加入 4 个以上的表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法找到一种在 MSAccess 中使用外连接来连接 4 个或更多表的方法.它适用于 SQL Server,但不适用于 Access.我不相信这是可能的.我有表 A、B、C、D 和 E.我需要像这样连接表:

I have not been able to find a way to join 4 or more tables using outer join in MSAccess. It works in SQL Server, but not Access. I don't believe it is possible. I have tables A, B, C, D and E. I need to join the tables like so:

  • A 左外连接 B
  • 左外连接 C
  • 内连接 D
  • B 内连接 E

当您在 FROM 子句中使用 LEFT/RIGHT/INNER JOINS 时,Access 不会让您在 where 子句中使用常规连接.如果这样做,我会收到非常非常模糊的错误,例如不支持 JOIN 表达式"或查询表达式中的语法错误(缺少运算符)".我也许可以使用传递查询,但我还不知道如何做到这一点.我可以加入的最多表是 3 个,外连接如下:

Access won't let you use conventional joins in the where clause when you use LEFT/RIGHT/INNER JOINS in the FROM clause. If you do, I get very, very vague errors like "JOIN expression not supported" or "Syntax error (missing operator) in query expression". I may be able to use a pass-through query, but I don't know how to do that yet. The most tables I can join are 3 with outer joins like this:

FROM(A 在 A.b = B.b 上左加入 B)
在 A.c = C.c 上左连接 C

FROM (A left join B on A.b = B.b)
left join C on A.c = C.c

也不要说outer"关键字不允许,因为虽然它不在文档中,但它确实接受了.

Don't say anything about 'outer' keyword not allowed either, because though it is not in the documentation, it does accept it.

推荐答案

一个常见的解决方法是使用保存的查询来连接您的第一对表,并使用从那里开始的连续查询向上构建.虽然对未来需要哪些数据访问路径进行一些预先考虑可以帮助保持合理的逻辑性.

A common work around for this is to use saved queries to join your first pair of tables and build upwards using successive queries from there. It's messy, although some forethought as to what future data access paths will be required can help keep things reasonably logical.

这篇关于如何使用内部/外部组合在 Access 中加入 4 个以上的表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆