I am using sql server 2014, and trying to get output with count of OPEN and CLOSED tickets from one table which contains 'CreatedDate' and 'Closeddate' columns.
I am using below query and ended up getting output as shown below.
SELECT CONVERT(VARCHAR(3), DATEFROMPARTS(2020, MONTH(CreatedDate), 1), 7) AS MONTH, count(*) as 'OPEN', count(*) as 'CLOSED' from dbo.SPSActivityClassBase where year(createddate)=2020 group by MONTH(CreatedDate) order by max(createddate);
But actual Closed count is different. Please help me out.
Thanks in Advance