任何人都可以找到此MS Access查询的错误吗?当我尝试执行它时,我在第二次左连接之前收到有关缺少操作符的错误
SELECT * FROM (
SELECT GetitUsageTemp.MemberID,
GetitUsageTemp.IDNumber,
GetitUsageTemp.Title,
GetitUsageTemp.Initials,
GetitUsageTemp.Forenames,
GetitUsageTemp.Surnames,
GetitUsageTemp.CellNumber,
GetitUsageTemp.EmailAddress,
Nz(August.[AugustUsage],0) AS AugustUsage
FROM GetitUsageTemp
LEFT JOIN
(SELECT dbo_Requests.fk_Members_ID, Count(dbo_Requests.Log_date) AS JulyUsage
FROM dbo_Requests
WHERE dbo_Requests.Log_date Between #07/01/2013# And #08/01/2013#
GROUP BY dbo_Requests.fk_Members_ID
) Requests
ON GetitUsageTemp.MemberID = Requests.fk_Members_ID
LEFT JOIN
(SELECT dbo_Requests.fk_Members_ID, Count(dbo_Requests.Log_date) AS AugustUsage
FROM dbo_Requests
WHERE dbo_Requests.Log_date Between #08/01/2013# And #09/01/2013#
GROUP BY dbo_Requests.fk_Members_ID
) August
ON GetitUsageTemp.MemberID = August.fk_Members_ID
)GETIT
答案 0 :(得分:2)
在Access中,您只能加入两个表。如果需要连接更多表,则需要使用括号将第一个连接组合在一起,就好像它是一个新的派生表一样。然后,您可以将另一个表加入该组:
select
*
from
( ( Table1
LEFT JOIN Table2 ...
)
LEFT JOIN Table3 ...
)
LEFT JOIN Table4 ...
(我正在使用笨拙的缩进试图让这些组更清晰)