Posts eligible for keeper/archivist/curator

0

Please login or register to vote for this query.

(click on this box to dismiss)

Psychology & Neuroscience Meta

Q&A about the site for practitioners, researchers, and students in cognitive science, psychology, neuroscience, and psychiatry

select p.id, p.owneruserid
  from posts p
  join posts q
    on p.parentid = q.id
   and p.owneruserid <> q.owneruserid
  join posthistory ph
    on p.parentid = ph.postid
   and p.owneruserid = ph.userid
   and p.creationdate between dateadd(hour, -12, ph.creationdate)
                          and dateadd(hour,  12, ph.creationdate)
  join votes v
    on p.id = v.postid
   and p.creationdate between dateadd(hour, -12, v.creationdate)
                          and dateadd(hour,  12, v.creationdate)
 where p.posttypeid = 2
   and p.owneruserid = 445517
   and ph.posthistorytypeid in (4, 5)
   and q.posttypeid = 1
   and q.closeddate is null
   and v.votetypeid in (2, 3)
   and not exists ( select 1 
                      from votes 
                     where postid = p.id
                       and v.votetypeid = 6
                       and v.creationdate <= dateadd(hour, 12, p.creationdate)
                           )
 group by p.id, p.owneruserid
having sum(case when v.votetypeid = 2 then 1 else -1 end) >= 1

Enter Parameters

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