Post Count by Tag

0

Please login or register to vote for this query.

(click on this box to dismiss)

The Workplace Meta

Q&A about the site for members of the workforce navigating the professional setting

-- Post Count by Tag
-- Enter Query Description

SELECT T.TagName,
COUNT(*) as [Total],
SUM(CASE WHEN P.AcceptedAnswerId is not null THEN 1 ELSE 0 END) AS [Answered],
SUM(CASE WHEN p.ClosedDate IS NOT NULL THEN 1 ELSE 0 END) AS [Closed]
FROM POSTS P
INNER JOIN PostTags PT on (P.ID=PT.PostID)
INNER JOIN Tags T on (PT.TagID=T.ID)
WHERE P.PostTypeId = 1
GROUP BY T.TagName
ORDER BY Count(*) DESC

Enter Parameters

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