Q&A about the site for information security professionals
declare @UserId int = ##UserID##; select year(PostFeedback.CreationDate) , count(case when Posts.PostTypeId = 1 and PostFeedback.VoteTypeId = 2 then 1 end) QUpVotes , count(case when Posts.PostTypeId = 1 and PostFeedback.VoteTypeId = 3 then 1 end) QDownVotes , count(case when Posts.PostTypeId = 1 and PostFeedback.VoteTypeId = 4 then 1 end) QOffensive , count(case when Posts.PostTypeId = 2 and PostFeedback.VoteTypeId = 2 then 1 end) AUpVotes , count(case when Posts.PostTypeId = 2 and PostFeedback.VoteTypeId = 3 then 1 end) ADownVotes , count(case when Posts.PostTypeId = 2 and PostFeedback.VoteTypeId = 4 then 1 end) AOffensive , count(case when PostFeedback.VoteTypeId = 2 then 1 end) TUpVotes , count(case when PostFeedback.VoteTypeId = 3 then 1 end) TDownVotes , count(case when PostFeedback.VoteTypeId = 4 then 1 end) TOffensive from PostFeedback inner join Posts on Posts.Id = PostFeedback.PostId where Posts.OwnerUserId = @UserId and Posts.DeletionDate is null --and Posts.CommunityOwnedDate is null group by year(PostFeedback.CreationDate) order by year(PostFeedback.CreationDate)