Average score, viewcount and answercount per tag

1

Please login or register to vote for this query.

(click on this box to dismiss)

Drupal Answers Meta

Q&A about the site for Drupal developers and administrators

SELECT TOP(##num?500##)
  t.TagName,
  t.Count,
  AVG(CAST(p.Score AS decimal)) [Average Score],
  AVG(CAST(p.ViewCount AS decimal)) [Average ViewCount],
  AVG(CAST(p.AnswerCount AS decimal)) [Average AnswerCout]
FROM Posts p
  INNER JOIN PostTags pt ON p.Id = pt.PostId
  INNER JOIN Tags t ON pt.TagId = t.Id
WHERE (t.Count>=##min?10##) AND (t.Count<=##max?1000000000000##)
---I have included both parameters min and max
---Sometimes we're interestedonly in large tags.
---Sometimes we might want to look only at small tags
GROUP BY t.TagName, t.Count
ORDER BY t.Count DESC

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results