Q&A about the site for software engineers working on automated testing, continuous delivery, service integration and monitoring, and building SDLC infrastructure
with migrations as ( select postID , case when comment like 'to http://serverfault.com/%' then 'severfault' when comment like 'to http://meta.stackoverflow.com/%' then 'meta.so' when comment like 'to http://superuser.com/%' then 'superuser' when comment like 'to http://dba.stackexchange.com%' then 'dba.se' when comment like 'to http://programmers.stackexchange.com%' then 'programmers.se' end target , year(creationdate) yr, month(creationDate) m from postHistory where posthistoryTypeid in (17, 35) ) Select count(postID) M_Count, target, yr, m FROM migrations where target is not null group by yr, m, target order by yr, m, target