Questions that are closed, excluding duplicates

3

Please login or register to vote for this query.

(click on this box to dismiss)

Questions that are likely to need some delete votes. Duplicates should be left alone for the most part, so these are right out.

Stack Overflow

Q&A for programmers

SELECT p.Score,
       p.Id                                                                AS [Post Link],
       COALESCE(p.AnswerCount, 0)                                          AS [Answer Count],
       r.Name                                                              AS [Close Reason],
       CASE WHEN p.CommunityOwnedDate IS NOT NULL THEN 'Yes' ELSE NULL END AS Wiki,
       CASE WHEN h.UserId != -1                   THEN 'Yes' ELSE NULL END AS [Mod Closed],
       p.OwnerUserId                                                       AS [User Link]
FROM   Posts p
       INNER JOIN PostHistory h
         ON h.PostId = p.Id                   -- events pertaining to the question
            AND h.CreationDate = p.ClosedDate -- that occurred when it was closed
       INNER JOIN CloseReasonTypes r
         ON r.Id = CAST(h.Comment AS INT)
WHERE  p.PostTypeId = 1                  -- questions
       AND p.ClosedDate IS NOT NULL      -- that were closed
       AND h.PostHistoryTypeId = 10      -- and have a history entry for it
       AND h.Comment NOT IN ('1', '101') -- that says it's not a dupe
ORDER  BY p.Score ASC

Enter Parameters

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