我正在尝试从访问数据库连接多个表。当我加入两个它工作正常,但我需要加入9.尝试加入3像这样给出错误:
Syntax error (missing operator) in query expression
这是我的命令:
OleDbCommand gpInfoCommand = new OleDbCommand("SELECT * FROM GPInformation " +
"LEFT JOIN GPAvailability ON GPInformation.ID=GPAvailability.GPID " +
"LEFT JOIN GPCustomPayRates ON GPInformation.ID=GPCustomPayRates.GPID", connection);
答案 0 :(得分:1)
当存在多个连接时,MS Access需要在连接周围添加括号。请参阅此处的示例:Is it possible to do a 3 table join in MS-Access?
答案 1 :(得分:1)
MS Access具有多个连接的神秘语法,需要使用括号:
SELECT *
FROM (GPInformation LEFT JOIN
GPAvailability
ON GPInformation.ID = GPAvailability.GPID
) LEFT JOIN
GPCustomPayRates
ON GPInformation.ID = GPCustomPayRates.GPID;