rep per tag

0

Please login or register to vote for this query.

(click on this box to dismiss)

Sports

Q&A for participants in team and individual sport activities

select t.tagname
     , sum(case 
       when posttypeid = 1 then  -- Q 
          case 
          when v.votetypeid = 2 then 5 -- upmod
          when v.votetypeid = 3 then -2 -- downmod
          else 0
          end
       when posttypeid = 2 then -- A
          case 
          when v.votetypeid = 1 then 15 -- accept
          when v.votetypeid = 2 then 10 -- upmod
          when v.votetypeid = 3 then -2 -- downmod
          when v.votetypeid = 9 then v.bountyamount
          else 0
          end
          end) as [Reputation]

from posts p 
inner join posttags pt on pt.postid = coalesce(p.parentid, p.id)
inner join tags t on t.id = pt.tagid
left outer join votes v on v.postid = p.id
where p.owneruserid =1153938 
and p.posttypeid in (1,2)
and v.votetypeid in (1, 2, 3, 9)
group by t.tagname

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results