Average tag count per question


Please login or register to vote for this query.

(click on this box to dismiss)

Returns average number of tags per question on a site. Additionally it also returns tag count breakdown with question counts. Best viewed as "Text-only results"

Hinduism Meta

Q&A about the site for followers of the Hindu religion and those interested in learning more about Hinduism

with Counts as (
    len(Tags) - len(replace(Tags, '<', '')) as Tags,
    count(*) as QuestionCount
  from Posts
  where PostTypeId = 1
  group by len(Tags) - len(replace(Tags, '<', ''))
  cast(Tags as varchar) as [Tags per question],
  replace(convert(varchar, cast(QuestionCount as money), 1), '.00', '') as [Number of questions]
from Counts
union all
  'Avg = ' + cast((cast(sum(Tags * QuestionCount) as decimal) / sum(QuestionCount)) as varchar),
  'All = ' + replace(convert(varchar, cast(sum(QuestionCount) as money), 1), '.00', '')
from Counts

Enter Parameters

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