One vote from Remove Abandoned Closed

1

Please login or register to vote for this query.

(click on this box to dismiss)

Show all questions that a single user can delete, simply by downvoting, via the "Remove Abandoned Closed" mechanism.

Stack Overflow

Q&A for professional and enthusiast programmers

--Show all questions that a single user can delete, simply by downvoting, via the "Remove Abandoned Closed" mechanism
--It assumes that the user running the script hasn't already downvoted on the question or any of its answers
--Removed Abandoned Closed criteria: https://meta.stackexchange.com/a/92006/300411
--Does not take into account the "pending reopen votes" criteria
--Does not take into account edits made more recently than the last SEDE update

SELECT 
    p.Id AS [Post Link],
    p.Score,
    p.CreationDate as [Asked Date],
    p.ViewCount
FROM
    Posts p
WHERE
    p.AcceptedAnswerId IS NULL
    AND
    p.PostTypeId = 1
    AND
    p.LastEditDate < GETDATE() - 9
    AND
    p.CommunityOwnedDate IS NULL
    AND
    p.ClosedDate < GETDATE() - 9
    AND
    p.Score <= ##MaxQuestionScore?1##
AND NOT EXISTS --Highest answer score 1 or less
    (
        SELECT *
        FROM Posts p2
        WHERE p2.ParentId = p.Id
        AND p2.Score > ##HighestAnswerScore?1##
        AND p2.PostTypeId = 2
    )
AND NOT EXISTS --Not a locked question
    (
        SELECT *
        FROM PostHistory ph
        WHERE ph.PostId = p.Id
        AND ph.PostHistoryTypeId = 14
     )  
AND NOT EXISTS --Not a duplicate, part 1
    (
        SELECT *
        FROM PostHistory ph
        WHERE ph.PostId = p.Id
        AND ph.PostHistoryTypeId = 10
        AND ph.Comment = 101
     )  
AND NOT EXISTS --Not a duplicate, part 2
    (
        SELECT *
        FROM PostHistory ph
        WHERE ph.PostId = p.Id
        AND ph.PostHistoryTypeId = 10
        AND ph.Comment = 1
        )
ORDER BY
    p.CreationDate DESC

Enter Parameters

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