select avg(datediff(hh,closed,opened)) as reopen_after_ho...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Hardware Recommendations

Q&A for people seeking specific hardware recommendations

select avg(datediff(hh,closed,opened)) as reopen_after_hours
from 
(
select po.postid
     , min(ph.creationdate) as closed
     , max(po.creationdate) as opened
from posthistory ph 
inner join posthistory po on po.postid = ph.postid
where ph.posthistorytypeid =10 -- closed
and po.posthistorytypeid =11 -- reopen
and po.creationdate > ph.creationdate -- multiple re-opens/ closes screw up here
group by po.postid
) as co

Enter Parameters

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