Longest time without any posts

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

WITH Dates AS (
  SELECT
    ROW_NUMBER() OVER (ORDER BY CreationDate ASC) N,
    CreationDate,
    Id
  FROM
    PostsWithDeleted p
)

SELECT TOP 10
  prev.CreationDate prevdate,
  curr.CreationDate currdate,
  DATEDIFF(MINUTE, prev.CreationDate, curr.CreationDate) timediff,
  prev.Id [Post Link],
  curr.Id [Post Link]
FROM
  Dates curr INNER JOIN Dates prev ON prev.N = curr.N - 1
ORDER BY
  timediff DESC

Enter Parameters

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