Q&A for professional and enthusiast programmers
select upmod , downmod , datediff(d, first, last) days , postid as [Post Link] from ( select sum(case when votetypeid = 2 then 1 else 0 end) as upmod , sum(case when votetypeid = 3 then 1 else 0 end) as downmod , min(creationdate) as first , max(creationdate) as last , postid from votes where votetypeid in (2,3) group by postid having sum(case when votetypeid = 2 then 1 else 0 end) > 300 -- close vote ) as data order by datediff(d, first, last) asc