Top answerers on site (by count)

1

Please login or register to vote for this query.

(click on this box to dismiss)

Code Review

Q&A for peer programmer code reviews

--@NumberOfUsers is the number of users you want to return.


SELECT 
    TOP ##NumberOfUsers:int?100##
    RANK() OVER (ORDER BY (COUNT(Posts.Id)) DESC) AS [Rank],
    Users.Id AS [User Link],
    Users.DisplayName AS UserName,
    COUNT(Posts.Id) AS [Total Answers]
FROM
    Posts
JOIN
    Users ON Users.Id = OwnerUserId
WHERE 
    PostTypeId = 2 
    AND CommunityOwnedDate IS NULL 
    AND ClosedDate IS NULL
GROUP BY
    Users.Id, Users.DisplayName
HAVING
    COUNT(Posts.Id) > 10
ORDER BY
    [Total Answers] DESC

Enter Parameters

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