Q&A for programmers
select datepart(mm, e.CreationDate) as [month] ,datepart(yyyy, e.CreationDate) as [year] ,count(distinct e.PostId) as closes from PostHistory c join PostHistory e on e.PostId=c.PostId where c.CreationDate < e.CreationDate and c.PostHistoryTypeId = 10 -- Close and (e.PostHistoryTypeId = 4 or e.PostHistoryTypeId = 5) -- Edit group by datepart(mm, e.CreationDate) ,datepart(yyyy, e.CreationDate) order by datepart(yyyy, e.CreationDate) ,datepart(mm, e.CreationDate)
Error: looks like you typed in the wrong words - try again