Closed questions

0

Please login or register to vote for this query.

(click on this box to dismiss)

A list of closed questions by tag

Stack Overflow

Q&A for professional and enthusiast programmers

-- Bugs:
-- Questions count as closed even after they are reopened.
--    (The query just checks ClosedDate.)
-- Questions that are closed more than once inflate the closed count.
--    [james-bond] on scifi.SE shows up as 150% closed because of this.


-- MinTotal: Min question count
DECLARE @min_total INT = ##MinTotal:INT?1##;
-- MaxTotal: Max question count "0 to disable"
DECLARE @max_total INT = ##MaxTotal:INT?0##;

SELECT *
FROM
  (
    SELECT
      t.TagName,
      Count(TagName) as Closed,
      t.Count as Total,
      ROUND(100.*Count(TagName)/t.Count,3) as [% Closed]
      FROM Posts p
      INNER JOIN PostTags pt ON p.Id = pt.PostId
      INNER JOIN Tags t ON pt.TagId = t.Id
      INNER JOIN PostHistory h ON p.Id = h.PostId
      WHERE
        p.PostTypeId = 1                  -- match questions
        AND p.ClosedDate IS NOT NULL      -- that have been closed at some point
        AND h.PostHistoryTypeId = 10      -- and have a history entry
        AND h.Comment NOT IN ('1', '101') -- that doesn't say it's a duplicate
      GROUP BY TagName, t.Count
  ) a
WHERE a.Total >= @min_total
AND (a.Total <= @max_total OR @max_total < 1) 

ORDER BY
    Closed DESC, Total DESC

Enter Parameters

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