Top 1k Tags: Number of Accepted Answers

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

WITH TopTags as
(SELECT TOP 1500 Id, TagName, Tags.Count FROM Tags ORDER BY Count desc),

UpdatedPostTags AS
(SELECT TagId, TagName, PostId FROM PostTags INNER JOIN TopTags on TopTags.Id = TagId),

PostsUpdated AS 
(SELECT * FROM Posts INNER JOIN UpdatedPostTags on UpdatedPostTags.PostId = (case when (ParentId is null) then Posts.Id else ParentId END)),

PostsDate AS
(SELECT * FROM PostsUpdated WHERE Year(CreationDate) = '##Year##')

SELECT TagName, SUM(CASE WHEN PostTypeId = 1 THEN 1 ELSE 0 END) as NumQ, COUNT(AcceptedAnswerId) as NumAccept FROM PostsDate GROUP BY TagName;

Enter Parameters

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