当我在此代码中添加货币汇率时,Access 告诉我“您的查询不包括指定的表达式 [交易详情]。[货币代码] = [货币]。[货币代码] 作为聚合函数的一部分。” 这是什么意思,我该如何解决?
SELECT [Sales structure].Cluster,
[Sales structure].Country,
[Transaction details].[Sales company code],
[Sales structure].[Sales company name],
Year([Transaction details].[YYYY-MM-DD]) AS [Year],
Month([Transaction details].[YYYY-MM-DD]) AS [Month],
Sum([Transaction details].[Sales volume LOC]) AS Sales,
[Transaction details].[Customer code]
FROM Currencies
RIGHT JOIN ([Sales structure]
RIGHT JOIN [Transaction details]
ON [Sales structure].[Sales company code] = [Transaction details].[Sales company code])
ON Currencies.[Currency code] = [Transaction details].[Customer code]
GROUP BY [Sales structure].Cluster,
[Sales structure].Country,
[Transaction details].[Sales company code],
[Sales structure].[Sales company name],
Year([Transaction details].[YYYY-MM-DD]),
Month([Transaction details].[YYYY-MM-DD]),
[Transaction details].[Customer code],
Currencies.[CUR/EUR]
HAVING (( [Transaction details].[Currency code] = [Currencies].[Currency code] ))
ORDER BY Year([Transaction details].[YYYY-MM-DD]),
Month([Transaction details].[YYYY-MM-DD]);