Q&A for apps, scripts, and development with the Stack Exchange API
SELECT Score, Id AS [Post Link], 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 AS [User Link] FROM Posts p WHERE ClosedDate IS NOT NULL -- closed AND (Score >= 0 OR 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