users with closure within 24 hours of first post

0

Please login or register to vote for this query.

(click on this box to dismiss)

Mi Yodeya

Q&A for those who base their lives on Jewish law and tradition and anyone interested in learning more

select udfp.owneruserid, count(ph.id) as numclosures
from (
  select p.owneruserid, min(p.creationdate) as dfp -- Datetime of First Post
  from posts p
  where p.posttypeid < 3 -- Q/A
  group by p.owneruserid
  ) udfp
left outer join posts p on
      p.owneruserid = udfp.owneruserid
  and p.posttypeid = 1 -- Q
left outer join posthistory ph on
      ph.posthistorytypeid = 10 -- closure
  and ph.postid = p.id
  and datediff(hh, udfp.dfp, ph.creationdate) < 24
group by udfp.owneruserid

having count(ph.id) > 0
order by count(ph.id) desc

Enter Parameters

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