Total Reputation From Posts by Post Type

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

select pt.Name
     , sum(case when v.VoteTypeId = 2 then 10
                when v.VoteTypeId = 3 then -2
           end) as [Post Reputation]
     , sum(case when v.VoteTypeId = 2 then 10
                when v.VoteTypeId = 3 then -2
                when v.VoteTypeId = 1 and pt.Id = 1 then 2
                when v.VoteTypeId = 1 and pt.Id = 2 then 15
           end) as [Post Reputation, inc. accepts]
     , sum(case when v.VoteTypeId = 16 then 2 end) as [Approved Edits]
  from Posts p
  join Votes v
    on p.Id = v.PostId
  join PostTypes pt
    on p.PostTypeId = pt.Id
 where p.OwnerUserId = ##UserID##
 group by pt.Name

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results