Access中的"join expression not supported"

Man*_*ngh 4 ms-access ms-access-2007

我正在用内连接编写SQL查询

select * from (table1 inner join table2 on table1.city = table2.code)
   inner join table3 on table3.col1 = 5 and table3.col2 = 'Hello'
Run Code Online (Sandbox Code Playgroud)

这给了我错误"不支持连接表达式".

但是,如果我像这样更改查询,则没有错误

select * from (table1 inner join table2 on table1.city = table2.code)
   inner join table3 on table3.col1 = [SomeColumn] and table3.col2 = [SomeColumn]
Run Code Online (Sandbox Code Playgroud)

为什么Access会在第一个查询中给出错误?

小智 15

很晚但我在MS Access上遇到了与JOIN表达式类似的问题,如此处所述, Access有时需要查询的ON部分内的所有内容都在括号内,即:

SELECT ... JOIN <table> ON (everything here inside the parenthesis) WHERE ...

  • 这个!!谢谢。 (2认同)
  • 如果这仍然不起作用?一直告诉我它仍然不受支持。 (2认同)

Gor*_*son 6

为什么 Access 在第一个查询时给出错误?

好吧,就像错误消息所说的那样,不支持这种形式的 JOIN 表达式。

您可能想尝试以下操作:

SELECT * FROM table1, table2, table3 
WHERE table1.city=table2.code AND table3.col1=5 AND table3.col2='Hello'
Run Code Online (Sandbox Code Playgroud)