Users with the largest percent of answers going to closed questions

0

Please login or register to vote for this query.

(click on this box to dismiss)

Ukrainian Language Meta

Q&A for linguists, teachers and students of the Ukrainian language

SELECT Users.Id as uid, Count(DISTINCT Posts.Id) as cnt
   INTO  #user_count 
   FROM Users INNER JOIN Posts
   ON Posts.OwnerUserId = Users.Id
   WHERE Posts.PostTypeId = 2 
   GROUP BY Users.Id;
   

SELECT
 TOP 500
    Users.Id AS [User Link],
    Count(DISTINCT ClosedQuestions.Id) as ClosedAnswerCount,
    Max(ucnt.cnt) as TotalAnswerCount,
    ROUND(100*CAST(Count(DISTINCT ClosedQuestions.Id) as float)/Max(ucnt.cnt) ,2) 
       AS PercentClosed
FROM
 Users 
 INNER JOIN Posts as ClosedAnswers
    ON ClosedAnswers.OwnerUserId = Users.Id
 INNER JOIN Posts as ClosedQuestions
    ON ClosedQuestions.id = ClosedAnswers.ParentId
 INNER JOIN #user_count as ucnt
    ON ucnt.uid = Users.Id
WHERE 
 ClosedAnswers.PostTypeId = 2
 AND ClosedAnswers.CommunityOwnedDate is null
 AND ClosedQuestions.PostTypeId = 1
 AND ClosedQuestions.ClosedDate is not null
 AND ucnt.cnt > 500

GROUP BY Users.Id
ORDER BY PercentClosed DESC;

Enter Parameters

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