1

谁能找到这个 MS Access Query 的问题?当我尝试执行它时,我在第二次左连接之前收到关于缺少运算符的错误

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
4

1 回答 1

2

在 Access 中,您只能连接两个表。如果您需要连接更多表,则需要使用括号将第一个连接组合在一起,就好像它是一个新的派生表一样。然后您可以将另一个表加入该组:

select
  *
from
  ( ( Table1 
      LEFT JOIN Table2 ...
    )
    LEFT JOIN Table3 ...
  )
  LEFT JOIN Table4 ...

(我正在使用笨拙的缩进来尝试使组更清晰)

于 2013-09-25T11:00:31.607 回答