Q&A for scientists using computers to solve scientific problems
WITH Batches AS ( SELECT DATEADD(mm, DATEPART(mm, Post.CreationDate)-1, DATEADD(yy, DATEPART(yyyy, Post.CreationDate)-1900, 0)) as [Date], COUNT(*) as Total, SUM(CASE when Post.LastEditorUserId is not null then 1 else 0 END) as [Edited] FROM PostsWithDeleted as Post GROUP BY DATEPART(yyyy, Post.CreationDate), DATEPART(mm, Post.CreationDate) ) SELECT [Date], Total, Edited FROM Batches ORDER BY Date;