Users with highest median answer score

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

SELECT 
    TOP 100
    Users.Id,
    DisplayName,
    Count(Posts.Id) AS Answers,
    (SELECT MAX(Score) 
     FROM (SELECT TOP 50 percent Score
           FROM Posts as PU
           WHERE PostTypeId = 2 and CommunityOwnedDate IS NULL and PU.OwnerUserId = Users.Id
           ORDER BY Score
           ) as t
     ) AS MedianAnswerScore
FROM
    Posts
  INNER JOIN
    Users ON Users.Id = OwnerUserId
WHERE 
    PostTypeId = 2 and CommunityOwnedDate IS NULL
GROUP BY
    Users.Id, DisplayName
HAVING
    Count(Posts.Id) > 100
ORDER BY
    MedianAnswerScore DESC

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results
:records returned in :time ms:cached