Top users in a tag by score and answer count

0

Please login or register to vote for this query.

(click on this box to dismiss)

Science Fiction and Fantasy

Q&A for science fiction and fantasy enthusiasts

SELECT TOP 10
       TagUsers.UserLink AS [User Link],
       TagUsers.Score AS Score,
       TagUsers.[Count] AS [Count],
       (TagUsers.Score + TagUsers.[Count]) / 2.0 AS Total
FROM
(
    SELECT a.OwnerUserId AS UserLink,
           SUM(a.Score) / 10.0 AS Score,
           COUNT(a.Score) AS [Count]
    FROM Posts a, 
         Posts q
         INNER JOIN PostTags pt ON q.Id = pt.PostId
         INNER JOIN Tags t ON t.Id = pt.TagId
    WHERE a.ParentId = q.Id
      AND a.PostTypeId = 2
      AND a.CommunityOwnedDate IS NULL
      AND t.TagName = '##tagName##'
    GROUP BY a.OwnerUserId
) TagUsers
ORDER BY (TagUsers.Score + TagUsers.[Count]) / 2 DESC

Enter Parameters

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