with seq as ( select top 10000 id , creationdate , postid...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Meta Stack Exchange

Q&A for meta-discussion of the Stack Exchange family of Q&A websites

with seq as (
  select top 10000 id
       , creationdate
       , postid
       , (select min(id) 
         from posthistory 
         where id > f.id) as next_id
  from posthistory f
)
  
select s.id
     , s.creationdate [lower]
     , s.postid as [Post Link]
     , s.next_id
     , ph.creationdate [higher]
     , ph.postid as [Post Link]
from seq s
inner join posthistory  ph on s.next_id = ph.id
where ph.creationdate < s.creationdate
order by id

Enter Parameters

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