Tag Question/Answer counts.

0

Please login or register to vote for this query.

(click on this box to dismiss)

SharePoint

Q&A for SharePoint enthusiasts

WITH TagQACounts AS (
  SELECT 
    T.TagName, 
    COUNT(P.Id) AS QuestionCount,
    SUM(CASE WHEN AnswerCount > 0 THEN 1 ELSE 0 END) AS WithAnyAnswer,
    SUM(CASE WHEN AcceptedAnswerId IS NULL THEN 0 ELSE 1 END) AS WithAcceptedAnswer,
    AVG(CAST(P.AnswerCount as decimal(10,2))) AS AvgAnsCount
  FROM Posts P
    INNER JOIN PostTags PT ON PT.PostId = P.Id
    INNER JOIN Tags T ON T.Id = PT.TagId
  GROUP BY T.TagName
)

SELECT TagName, QuestionCount, WithAnyAnswer, WithAcceptedAnswer, AvgAnsCount,
  (WithAnyAnswer * 100.00)/QuestionCount AS PercentAnswered,
  (WithAcceptedAnswer * 100.00)/QuestionCount AS PercentAccepted
FROM TagQACounts
WHERE TagName IN ('react-native')

Enter Parameters

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