SELECT Posts.Id AS [Post Link] FROM Posts JOIN ( SELECT P...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Meta Stack Overflow

Q&A about Stack Overflow, Server Fault and Super User

SELECT
  Posts.Id AS [Post Link]
FROM
  Posts
JOIN
  (
    SELECT
      PostId,
      CASE WHEN p.PostHistoryTypeId = 19 THEN 1 ELSE 0 END AS IsProtected
    FROM
      PostHistory p
    JOIN
      (
        SELECT
          MAX(Id) Id
        FROM
          PostHistory 
        WHERE
          PostHistoryTypeId IN(19, 20)
        GROUP BY PostId
      ) m ON p.Id = m.Id
  ) History ON Posts.Id = History.PostId
WHERE
  History.IsProtected = 1

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results
:records returned in :time ms:cached