Top 100 users by the product (questions)*(answers)

1

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 (
  select 
    *,
    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,
  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 as product
from user_posts
order by product desc

Enter Parameters

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