【问题标题】:Access - 3rd Left join with multiple criteria not working访问 - 多个条件不起作用的第 3 个左连接
【发布时间】:2018-05-15 14:48:27
【问题描述】:

我正在尝试使用 LEFT JOIN 合并来自多个表(至少 6 个)的数据。当我向查询中添加第三个 LEFT JOIN 时,我收到错误“不支持 JOIN EXPRESSION”。

SELECT *
FROM
(
(Flat_File ff
left join Cost_Drivers cd on cd.Cost_Driver_Reported_Name = ff.Cost_Driver)
left join BM_IAA bmiaa on bmiaa.Section_Name = cd.Cost_Driver_Billing_Model_Section_Name)
left join BM_Allocations bma 
on
(bma.Fiscal_Year = ff.Fiscal_Year) and (bma.Section_Name = cd.Cost_Driver_Billing_Model_Section_Name)

这样做会给我“不支持联接表达式”错误。但是,如果我删除最终左连接中的一个条件,它会起作用。我有语法问题吗?

【问题讨论】:

  • 我想如果你把()都去掉,应该没问题。

标签: sql ms-access join


【解决方案1】:

在 MS Access 中,如果您有多个联接,则必须用括号括住所有联接。

您的查询应该是

SELECT *
FROM
(((Flat_File ff
left join Cost_Drivers cd on cd.Cost_Driver_Reported_Name = ff.Cost_Driver)
left join BM_IAA bmiaa on bmiaa.Section_Name = cd.Cost_Driver_Billing_Model_Section_Name)
left join BM_Allocations bma 
   on ((bma.Fiscal_Year = ff.Fiscal_Year) and (bma.Section_Name = cd.Cost_Driver_Billing_Model_Section_Name)))

【讨论】:

  • 应该 --> 必须。
  • 神圣的@Andre :)
  • 非常感谢您的回答,但我仍然收到错误消息。我认为这与最终连接中的额外标准有关。如果我删除其中任何一个,则不会发生错误。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-12-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多