Top 100 users by min(questions, answers)


Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

with q_and_as as (
    case when posttypeid = 1 then 1 else null end as isq,
    case when posttypeid = 2 then 1 else null end as isa
  from posts
  where posttypeid = 1 or posttypeid = 2

user_posts as (select 
  owneruserid as [User Link],
  sum(isq) as questions,
  sum(isa) as answers
from q_and_as
group by owneruserid

select top 100 
[User Link], questions, answers, (questions+answers-abs(answers-questions))/2 as minimum
from user_posts
order by minimum desc

Enter Parameters

Switch sites:
loading Hold tight while we fetch your results