Q&A for system and network administrators
-- http://blog.stackoverflow.com/2010/03/important-reputation-rule-changes/ declare @epoch datetime = '##epoch?2010-03-19##'; with sample_posts as ( select p.Id, p.CreationDate posted, Score, case when p.CreationDate < @epoch then case when PostTypeId = 1 then 'ten_question' when PostTypeId = 2 then 'ten_answer' end when p.CreationDate >= @epoch then case when PostTypeId = 1 then 'five_question' when PostTypeId = 2 then 'five_answer' end end post_type from Posts p where PostTypeId in (1,2) ) select --count(*), dateadd(week, datediff(week, @epoch, posted), @epoch) week, sum(case when post_type = 'ten_question' then Score end) - sum(case when post_type like 'ten_answer' then Score end) ten_score, sum(case when post_type = 'five_question' then Score end) - sum(case when post_type like 'five_answer' then Score end) five_score from sample_posts group by datediff(week, @epoch, posted) having count(*) > 150 order by datediff(week, @epoch, posted)