Q&A for Drupal developers and administrators
SELECT DATEFROMPARTS( YEAR(PostsWithDeleted.DeletionDate), MONTH(PostsWithDeleted.DeletionDate), 1) AS Month, COUNT(*) AS Count FROM Votes, PostsWithDeleted WHERE Votes.PostId = PostsWithDeleted.Id AND Votes.VoteTypeId = 2 AND PostsWithDeleted.DeletionDate IS NOT NULL GROUP BY DATEFROMPARTS( YEAR(PostsWithDeleted.DeletionDate), MONTH(PostsWithDeleted.DeletionDate), 1) ORDER BY Month