Questions deleted the longest time

1

Please login or register to vote for this query.

(click on this box to dismiss)

Raspberry Pi

Q&A for users and developers of hardware and software for Raspberry Pi

WITH Raw AS (
  SELECT
    PostHistory.Id,
    Posts.Id AS PostId,
    PostHistory.PostHistoryTypeId,
    PostHistory.CreationDate,
    RANK() OVER (PARTITION BY Posts.Id ORDER BY PostHistory.Id) AS No
  FROM PostHistory, Posts
  WHERE
    PostHistory.PostId = Posts.Id
    AND
    Posts.PostTypeId = 1
    AND
    PostHistory.PostHistoryTypeId BETWEEN 12 AND 13
)
SELECT TOP 100
  Del.PostId AS [Post Link],
  Del.CreationDate AS Deleted,
  Undel.CreationDate AS Undeleted
FROM Raw Del, Raw Undel
WHERE
  Del.PostId = Undel.PostId
  AND
  Del.PostHistoryTypeId = 12
  AND
  Undel.PostHistoryTypeId = 13
  AND
  Undel.No = Del.No + 1
ORDER BY DATEDIFF(s, Del.CreationDate, Undel.CreationDate) DESC

Enter Parameters

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