我在下面一段代码中组合一些内部联接时遇到了一些麻烦:
SELECT Table1FakeName.Field1
FROM Table1 AS Table1FakeName
INNER JOIN Table2 AS Table2FakeName ON Table1FakeName.Field2 = Table2FakeName.Field2
INNER JOIN Table3 AS Table3FakeName ON Table2FakeName.Field2 = Table3FakeName.Field2;
我收到以下错误:
查询表达式'Table2FakeName.Field2中的语法错误(缺少运算符) INNER JOIN Table3 AS Table3FakeName ON Table2FakeName.Field2 = Table3FakeName.Field2'
PS:请不要对这篇文章投反对票。如果您有理由这样做,请在评论部分讨论。
答案 0 :(得分:1)
试试这个:
SELECT Table1FakeName.Field1
FROM ((Table1 AS Table1FakeName
INNER JOIN Table2 AS Table2FakeName
ON Table1FakeName.Field2 = Table2FakeName.Field2)
INNER JOIN Table3 AS Table3FakeName
ON Table2FakeName.Field2 = Table3FakeName.Field2);
在Access中,对于您加入的每个额外表,在FROM子句之前需要一个额外的括号,以及JOIN的ON子句的一个结束括号。