Q&A for professional and enthusiast programmers
Select DATEADD(mm, (Year(CreationDate) - 1900) * 12 + Month(CreationDate) - 1, 0) As [Month], Case VoteTypeId When 2 Then 'Upvotes' When 3 Then 'Downvotes' End As [Vote Type], Count(Id) As Votes From PostFeedback Group By Year(CreationDate), Month(CreationDate), VoteTypeId Order By Year(CreationDate), Month(CreationDate), VoteTypeId