3
下面的連接在Access中工作,但我需要添加第四個連接。使用多個左連接的MS Access SQL
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
當我添加第四個連接時,它不起作用。我知道Access對括號很奇怪,但我認爲我有他們屬於他們的地方。查詢只會永遠運行(它不應該長時間運行),我最終取消它。有什麼建議麼?
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)
LEFT JOIN OneMore ON Agents.OM = OneMore.OM
這是代碼的作品 - 我的實際查詢,而不是一個我發現看起來相似。
SELECT DISTINCT A02.PID, A02.PS, A02.PN, A02.PM, C01.RC, C01.IC, C01.RD
INTO AutoCR
FROM ((02_CorrectResults A02
LEFT OUTER JOIN dbo_pol_PGI C01
ON (A02.PID = C01.PID and C01.PS = '999' and C01.PEDate >= #04/01/2012#))
LEFT OUTER JOIN dbo_pol_IL C02
ON C01.PID = C02.PID)
LEFT OUTER JOIN dbo_pol_UN C03
ON C02.ILID = C03.ILID
我添加另一個連接,這是行不通的。我嘗試使用內部連接,而不是Access。
SELECT DISTINCT A02.PID
, A02.PS
, A02.PN
, A02.PM
, C01.RC
, C01.IC
, C01.RD
, C04.CCode
, C04.PCode
, C04.CForm,
INTO AutoCR
FROM (((02_CorrectResults A02
LEFT OUTER JOIN dbo_rol_PGI C01
ON (A02.PID = C01.PID and C01.PS = '999' and C01.PEDate >= #04/01/2012#))
LEFT OUTER JOIN dbo_rol_IL C02
ON C01.PID = C02.PID)
LEFT OUTER JOIN dbo_rol_UN C03
ON C02.ILID = C03.ILID)
LEFT OUTER JOIN dbo_rol_HO C04
ON C03.UnID = C04.UnID
當你刪除括號的時候會發生什麼? 你可以顯示整個查詢嗎? – Ogelami 2013-03-27 10:11:39
使用設計器 – mcalex 2013-03-27 10:11:45
設計器給出錯誤Microsoft Access無法在設計視圖中表示聯接表達式。 – Tracy 2013-03-27 11:36:13