Tag State

1

Please login or register to vote for this query.

(click on this box to dismiss)

Queries counts for the Answered, Closed, Accepted stats

Ukrainian Language Meta

Q&A about the site for linguists, teachers and students of the Ukrainian language

--@Merlin we want to know the percentage of questions which are:
--unanswered, that are not closed or wiki.
--low rep users (i.e < 12) have an up voted answer but no accepted answer
--percentage of unanswered questions by asker's reputation

--SET NOCOUNT ON; -- doesn't seem to work in data.SE
--GO

DECLARE @unanswered int = 0;
DECLARE @answered int = 0;
DECLARE @closedwo int = 0;


WITH TaggedPosts(PostId)
AS (
  SELECT pt.PostId as PostId
  FROM PostTags pt INNER JOIN Tags t ON t.Id=pt.TagId
  WHERE t.TagName LIKE '%' + ##tag:string## + '%'
  GROUP BY pt.PostId
)

SELECT
    CASE WHEN p.AcceptedAnswerId IS NULL THEN 'N' ELSE 'Y' END AS [Accepted],
    CASE WHEN p.ClosedDate IS NULL THEN 'N' ELSE 'Y' END AS [Closed],
    CASE WHEN p.AnswerCount = 0 THEN 'N' ELSE 'Y' END AS [Answers],
    count(tp.PostId) as Questions    
FROM TaggedPosts tp INNER JOIN Posts p ON p.Id=tp.PostId
WHERE
    PostTypeId = 1
GROUP BY
    CASE WHEN p.AcceptedAnswerId IS NULL THEN 'N' ELSE 'Y' END,
    CASE WHEN p.ClosedDate IS NULL THEN 'N' ELSE 'Y' END,
    CASE WHEN p.AnswerCount = 0 THEN 'N' ELSE 'Y' END
ORDER BY Accepted, Closed, Answers

Enter Parameters

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