2

我有一个必须包含 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'

是什么导致了这个错误?

4

1 回答 1

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
于 2013-03-10T20:11:22.983 回答