Tag Statistics v2

0

Please login or register to vote for this query.

(click on this box to dismiss)

Question count / Answer count / Avg Score for a particular tag

Christianity Meta

Q&A about the site for committed Christians, experts in Christianity and those interested in learning more

-- Tag Statistics v2
-- Question count / Answer count / Avg Score for a particular tag

declare 
   @answers int, 
   @questions int, 
   @askers int, 
   @answerers int, 
   @avgAnswerScore float, 
   @avgQuestionScore float,
   @qsPerAsker float,
   @asPerAnswerer float,
   @asPerQuestion float

set nocount on

select 
  @answers = count(*),
  @answerers = count(distinct p1.OwnerUserId), 
  @avgAnswerScore = avg(p1.Score + 0.0)
from Posts p
join Posts p1 on p1.ParentId = p.Id 
join PostTags pt on pt.PostId = p.Id
join Tags t on t.Id = pt.TagId 
where t.TagName = ##Tag:string##

select 
  @questions = count(*),
  @askers = count(distinct p.OwnerUserId),
  @avgQuestionScore = avg(Score + 0.0)
from Posts p
join PostTags pt on pt.PostId = p.Id
join Tags t on t.Id = pt.TagId 
where t.TagName = ##Tag:string##




set nocount off 

select @questions as [Questions], 
       @askers as [Askers],
       @avgQuestionScore as [Avg Question Score],
       @questions/@askers as [Questions per asker],
       @answers as [Answers], 
       @answerers as [Answerers], 
       @avgAnswerScore as [Avg Answer Score],
       @answers/@answerers as [Answers per answerer],
       @answers/@questions as [Answers per Q]

Enter Parameters

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