Distribution of Flagged Posts by Time (Hours) to close

0

Please login or register to vote for this query.

(click on this box to dismiss)

Health Meta

Q&A about the site for professionals in medical and allied health fields, students of those professions, related academics, and others with a sound understanding of medicine and healthcare-related sciences

SELECT diff1 as hoursToClose, count(*)
FROM (

  SELECT 
    DATEDIFF(hour, d.CreationDate, d.ClosedDate) as [diff1],
    FORMAT (d.CreationDate, 'yy-MM') as [date1],
    FORMAT (d.ClosedDate, 'yy-MM') as [date2],
    (d.Id) as id
  FROM Posts d 
    LEFT JOIN PostHistory ph ON ph.PostId = d.Id
    LEFT JOIN PostLinks pl ON pl.PostId = d.Id
    LEFT JOIN Posts o ON o.Id = pl.RelatedPostId  -- o=original
  WHERE
    (d.PostTypeId = 1 OR d.PostTypeId = 2)
    AND ph.PostHistoryTypeId = 10  -- 10=Post Closed
    
  ) as t1
group by diff1
order by diff1

Enter Parameters

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