我試圖按日期(mm/yyyy)對錶進行分組,然後按invoicetype進行分組,我嘗試將代碼放在下面的代碼中,但我一直在。錯誤 '無效的列日'SQl,多個問題(加入參數並將一列放入一行
SELECT RIGHT(CONVERT(VARCHAR(10), case_createddate, 103), 7) AS Date,
case_invoicetype,
Sum(case_totalexvat)
FROM cases AS ca
WHERE case_primaryCompanyid = 1111
GROUP BY ca.Date,
case_invoicetype
我嘗試這樣做:
group by YEAR(case_createddate), MONTH(case_createddate)
但我得到的錯誤:
case_createddate is invalid in the select list because it is not contained in either an aggregate function or the group by clause
有任何想法嗎 ?
感謝
,是完美的,太感謝你了, – Rachsherry