Currently Protected Questions, simple search

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT
    ph.PostId           AS [Post Link],
    ph.CreationDate     AS [Protected Date],
    CASE ph.UserId
        WHEN NULL       THEN ph.UserDisplayName
        ELSE            ph.UserId
    END AS [User Link]
FROM        PostHistory ph
WHERE       ph.PostHistoryTypeId = 19  -- protected
AND         NOT EXISTS (
                SELECT  * FROM PostHistory ph2 
                WHERE   ph2.PostId = ph.PostId
                AND     ph2.PostHistoryTypeId = 20  -- unprotected
                AND     ph2.CreationDate > ph.CreationDate
            )
ORDER BY    ph.PostId, ph.CreationDate

Enter Parameters

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