State of the your Tag

1

Please login or register to vote for this query.

(click on this box to dismiss)

Genealogy and Family History Meta

Q&A about the site for expert genealogists and people interested in genealogy or family history

--@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
)

/*
--UNANSWERED

SELECT @unanswered = count(tp.PostId)
FROM TaggedPosts tp INNER JOIN Posts p ON p.Id=tp.PostId
WHERE
    PostTypeId = 1
AND
    AcceptedAnswerId IS NULL
AND
    AnswerCount > 0
AND
    ClosedDate IS NULL

--ANSWERED

SELECT @answered = count(tp.PostId)
FROM TaggedPosts tp INNER JOIN Posts p ON p.Id=tp.PostId
WHERE
    PostTypeId = 1
AND
    AcceptedAnswerId IS NOT NULL
AND
    AnswerCount = 0
AND
    ClosedDate IS NULL
   */
-- CLOSED

SELECT @closedwo = count(tp.PostId)
FROM TaggedPosts tp INNER JOIN Posts p ON p.Id=tp.PostId
WHERE
    PostTypeId = 1
AND
    AcceptedAnswerId IS NULL
AND
    AnswerCount > 0
AND
    ClosedDate IS NOT NULL    
    
SELECT @unanswered as unaswered, @answered as answered, @closedwo as closedwo
    
SET NOCOUNT OFF;
GO

Enter Parameters

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