select top 100 ROW_NUMBER() OVER(order by sum(case votety...

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 top 100 
      ROW_NUMBER() OVER(order by sum(case votetypeid 
             when 2 then 1 
             when 3 then -1
             end) desc) AS [# Rank],
      p.owneruserid AS [User Link],
      count(distinct COALESCE(p.id, 0)) Answers,
      sum(case votetypeid 
             when 2 then 1 
             when 3 then -1
             end) AS [Score],
      sum(case votetypeid 
             when 2 then 10 
             when 3 then -2
             end) [Reputation]
from posts p
inner join posttags pt on pt.postid = p.parentid
inner join tags t on t.id = pt.tagid
left join votes v on p.id = v.postid

where t.tagname = ##tagname:string?angular##
and p.OwnerUserId IS NOT NULL
group by p.OwnerUserId
having count(distinct COALESCE(p.id, 0)) >= 180
order by sum(case votetypeid 
             when 2 then 1 
             when 3 then -1
             end) DESC

Enter Parameters

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