Count Reopened Questions Edited At All

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

SELECT COUNT(*)
FROM Posts p
WHERE 
    p.PostTypeId = 1 -- questions only
    AND EXISTS (
      SELECT * FROM PostHistory ph
          INNER JOIN PostHistory ph2 ON ph2.postId = ph.postId
          AND ph2.PostHistoryTypeId IN (5) -- edit title(4), body(5), tags(6)
            AND ph2.CreationDate > ph.CreationDate
      WHERE ph.postId = p.Id
        AND ph.PostHistoryTypeId = 10 -- closed
        )
    AND EXISTS (
      SELECT * FROM PostHistory ph
      WHERE ph.postId = p.Id
        AND ph.PostHistoryTypeId = 11 -- reopened
        )

Enter Parameters

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