我有一个必须包含3个连接的查询,但是我收到此错误:
语法错误(缺少运算符)
SQL:
SELECT
Agents.[PF],
Agents.[User_ID],
Agents.[First_Name],
Agents.[Second_Name],
Agents.[Third_Name],
Agents.[Family_Name],
Agents.[Gender],
Agents.[Contract_Type],
Agents.Area,
Teams.Team_Name,
Agents.Hiring_Date,
Resignation_Pool.Resignation_Date,
Resignation_Pool.Effective_Date,
Replace(
IIf(Skills.Skill_Directory IS NULL, '', 'Directory, ')
+ IIf(Skills.Skill_TRC IS NULL, '', 'TRC, ')
+ IIf(Skills.Skill_Prepaid IS NULL, '', 'Prepaid, ')
+ IIf(Skills.Skill_Postpaid IS NULL, '', 'Postpaid, ')
+ IIf(Skills.Skill_KeyAccount IS NULL, '', 'KeyAccount, ')
+ IIf(Skills.Skill_Blackberry IS NULL, '', 'Blackberry, ')
+ IIf(Skills.Skill_Broadband IS NULL, '', 'Broadband, ')
+ IIf(Skills.Skill_Concierge IS NULL, '', 'Concierge, ')
+ IIf(Skills.Skill_ISP IS NULL, '', 'ISP, ')
+ IIf(Skills.Skill_Mada IS NULL, '', 'Mada, ')
+ IIf(Skills.Skill_CSCS IS NULL, '', 'CSCS, ')
+ '$', ', $', ''
) AS Skills
FROM Agents
LEFT JOIN Resignation_Pool
ON Agents.PF = Resignation_Pool.PF
LEFT JOIN Teams
ON Agents.Team = Teams.ID
LEFT JOIN Skills
ON Agents.PF = Skills.PF
WHERE Agents.Contract_Status = 'Active'
导致此错误的原因是什么?
答案 0 :(得分:5)
MS Access需要围绕JOIN
语法的括号与多个表。你需要使用类似的东西:
FROM ((Agents
LEFT JOIN Resignation_Pool
ON Agents.PF = Resignation_Pool.PF)
LEFT JOIN Teams
ON Agents.Team = Teams.ID)
LEFT JOIN Skills
ON Agents.PF = Skills.PF