我有一個SQL查詢,像這樣:聚合函數導致錯誤
SELECT Month(mimos.mimo_date) & "-" & Year(mimos.mimo_date) AS monthyear,
Sum(Iif(mimos.amount < 0, mimos.amount, 0)) AS debits,
Sum(Iif(mimos.amount > 0, mimos.amount, 0)) AS credits
FROM mimos
GROUP BY monthyear,
debits,
credits;
這引發錯誤:
You tried to execute a query that does not include the specified expression ... as part of an aggregate function. (Error 3122)
我似乎無法儘管進行了廣泛的谷歌搜索來解決這個問題。有沒有人有解決方案?
Iif是訪問中的東西? – Mihai
它實際上是'iif'。美化大寫 – harryg
考慮格式()'建立'monthyear' ...'格式(mimos.mimo_date,'mm-yyyy')AS monthyear' – HansUp