Have My Edits Been Rolled-Back?

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

SELECT ph.Id, ph.PostId, ph.CreationDate, ph.Comment
INTO #Edits
FROM PostHistory ph
WHERE UserId = ##UserId:int##
  AND ph.PostHistoryTypeId IN (5,8) -- Edit, or Rollback
  AND DATEDIFF(day, ph.CreationDate, GETDATE()) <= ##MaxDayAge:int?14##
  
SELECT ph.PostId AS [Post Link], ph.CreationDate
FROM PostHistory ph INNER JOIN #Edits e ON e.PostId = ph.PostId
WHERE ph.PostHistoryTypeId IN (5,8) -- Edit, or Rollback
  AND e.CreationDate < ph.CreationDate -- new revision
ORDER BY ph.CreationDate DESC

Enter Parameters

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