select a.owneruserid as [User Link], rev.creationdate, case

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

select 
  a.owneruserid as [User Link],
  rev.creationdate,
  case 
    when lag(rev.creationdate) over (order by rev.creationdate) is not null
    then datediff(minute, lag(rev.creationdate) over (order by rev.creationdate), rev.creationdate)
    else null
  end as time_delta_minutes,
  rank() over (partition by rev.postid order by rev.creationdate) as revision,
  len(rev.text) - (
    case 
      when lag(rev.postid) over (order by rev.postid, rev.creationdate) != rev.postid
      then 0
      else len(lag(rev.text) over (order by rev.postid, rev.creationdate))
    end
  ) as size_delta,
  case
    when lag(rev.userid) over (order by rev.creationdate) != rev.userid
    then 1
    else 0
  end as accountswitch,
  a.id as [Post Link],
  formatmessage('https://stackoverflow.com/posts/%d/revisions#rev-body-%s', a.id, LOWER(CONVERT(CHAR(36), rev.RevisionGUID))) as [Revision Link]
from posts a
inner join posthistory rev on rev.postid = a.id and rev.userid = a.owneruserid
inner join posts q on a.parentid = q.id and a.posttypeid = 2
inner join posttags pt on q.id = pt.postid
inner join tags t on t.id = pt.tagid
where t.tagname = 'cypress'
and a.owneruserid in (
4716245,
8745435,
9161752,
9622173,
12697177,
14783414,
14903560,
15239601,
15544695,
16003578,
16461847
)
order by rev.creationdate

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results