Distribution of Flagged Posts by Time (Hours) to first flag

2

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

-------------------------
-- @author: Moradnejad --
-------------------------
select diff1, count(*)
from
(
    select d1,d2,
      FORMAT (d1, 'yy-MM') as [d1f],
      (12+DATEDIFF(hour, d1, d2)) as [diff1]
    from
    (
      select p.id, MIN(p.CreationDate) as d1, MIN(r.CreationDate) as d2
        from posts as p
        inner join [ReviewTasks] as r on r.PostId = p.id
        where p.posttypeid = 1 or p.posttypeid = 2
        group by p.id
    ) as t1
) as t2
where diff1>=0
group by diff1
order by diff1 asc

Enter Parameters

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