Q&A for professional and enthusiast programmers
select upmod , downmod , datediff(d, first, last) , postid 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 group by postid ) as data order by datediff(d, first, last) desc