Closed questions that won't be auto-deleted within a month, excluding duplicates

0

Please login or register to vote for this query.

(click on this box to dismiss)

Moderators

Q&A for community managers, administrators, and moderators

SELECT Score,
       Id                                                                ,
       CASE WHEN AnswerCount = 0 THEN NULL ELSE AnswerCount END          AS Answers,
       CASE WHEN AcceptedAnswerId   IS NOT NULL THEN 'Yes' ELSE NULL END AS Accepted,
       CASE WHEN CommunityOwnedDate IS NOT NULL THEN 'Yes' ELSE NULL END AS Wiki,
       CommentCount                                                      AS Comments,
       ViewCount                                                         AS Views,
       OwnerUserId                                                       
FROM   Posts p
WHERE  ClosedDate IS NOT NULL -- closed
       AND (Score >= 0 OR (AnswerCount IS NOT NULL AND AnswerCount > 0)) -- either not downvoted, or has answers
       AND NOT EXISTS (SELECT h.Id -- no post history entry for being closed as a dupe
                       FROM   PostHistory h
                       WHERE  h.PostId = p.Id
                              AND h.CreationDate = p.ClosedDate
                              AND PostHistoryTypeId = 10
                              AND Comment = '1'
                       )
ORDER  BY Score ASC, CreationDate DESC

Enter Parameters

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