Numbers of 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

DECLARE @UserId int = ##UserId##;

with all_posts as (
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
  join votes v
    on p.id = v.postid
 where p.posttypeid = 2
   and ph.posthistorytypeid in (4, 5)
   and q.posttypeid = 1
   and q.closeddate is null
   and v.votetypeid in (2, 3)
 group by p.id, p.owneruserid
having sum(case when v.votetypeid = 2 then 1 else -1 end) >= 1
       )

select *
  from all_posts
  where OwnerUserId = @UserId

Enter Parameters

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