Lists all currently locked posts, most recent first.
Q&A for professional and enthusiast programmers
SELECT p.Score, p.Id AS [Post Link], p.CreationDate AS [Creation Date], MAX(h.CreationDate) AS [Locked Date], p.OwnerUserId AS [User Link] FROM Posts p INNER JOIN PostHistory h ON h.PostId = p.Id WHERE h.PostHistoryTypeId IN (14) -- locked, unlocked AND p.PostTypeId = 2 -- answer and p.Score < 10 GROUP BY p.Id, p.Score, p.CreationDate, p.OwnerUserId -- derp? HAVING SUM(CASE WHEN h.PostHistoryTypeId = 14 THEN 1 ELSE -1 END) > 0 -- locked more often than unlocked ORDER BY [Score] DESC