Score per answer for users with at least 10 answers in the past 30 days in a tag.

1

Please login or register to vote for this query.

(click on this box to dismiss)

Software Engineering

Q&A for professionals, academics, and students working within the systems development life cycle

-- Score per answer for users with at least 10 answers in the past 30 days in a tag.

DECLARE @TagName nvarchar(255) = '##TagName##'

SELECT Posts.OwnerUserId AS [User Link],
       SUM(Score) AS Score,
       COUNT(*) AS Answers,
       ROUND(1.0 * SUM(Score)/COUNT(*), 2) AS ScorePerAnswer
FROM Posts
WHERE Posts.ParentId IN
    (SELECT Posts.Id
     FROM Posts
     INNER JOIN PostTags ON PostTags.PostId = Posts.Id
     INNER JOIN Tags ON Tags.Id = PostTags.TagId
     WHERE Tags.TagName = @TagName)
  AND Posts.CreationDate >= DATEADD(DAY, -30, GETDATE())
  AND Posts.CreationDate <= GETDATE()
GROUP BY Posts.OwnerUserId
HAVING COUNT(*) > 10
ORDER BY ScorePerAnswer DESC

Enter Parameters

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