For a particular Tag, average Upvotes per Answer

0

Please login or register to vote for this query.

(click on this box to dismiss)

Open Data

Q&A for developers and researchers interested in open data

-- For a particular tag, average Upvotes per Answer

SELECT
   COUNT(DISTINCT Questions.Id) As NumPosts,
   SUM(Answers.Score) As SumScore,
   COUNT(DISTINCT Questions.AcceptedAnswerId) AS AcceptedAnswers,
   AVG(Questions.ViewCount+0.0) AS AvgViews,
   AVG(Answers.Score+0.0) As AvgScore,
   AVG(DATEDIFF(day, Answers.CreationDate, CURRENT_TIMESTAMP)) AS AvgAge
FROM Posts AS Answers
INNER JOIN Posts AS Questions ON Answers.ParentId = Questions.Id
INNER JOIN PostTags ON Questions.Id = PostTags.PostId
INNER JOIN Tags ON PostTags.TagId = Tags.Id
WHERE Questions.PostTypeID = 1 AND Answers.PostTypeID = 2 
AND Tags.TagName = '##tagname##'

Enter Parameters

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