我想运行一个查询来获得按年和月分组的打开事件和已关闭事件的计数,下面的查询在没有分组的情况下工作正常,但是一旦我添加了组,它就不起作用了!
SELECT (SELECT COUNT(*) AS Opened FROM Incidents) AS Total
(SELECT COUNT(*) AS Solved FROM Incidents WHERE (MONTH(Closedate)=MONTH(Opendate))) AS Solved
GROUP BY YEAR(Incidents.Opendate)