【SQL】
select
SUBSTRING(CONVERT(char,DATEADD(m,-6,'2006/5/01'),112),1,6) AS MAE6,
SUBSTRING(CONVERT(char,DATEADD(m,-5,'2006/5/01'),112),1,6) AS MAE5,
SUBSTRING(CONVERT(char,DATEADD(m,-4,'2006/5/01'),112),1,6) AS MAE4,
SUBSTRING(CONVERT(char,DATEADD(m,-3,'2006/5/01'),112),1,6) AS MAE3,
SUBSTRING(CONVERT(char,DATEADD(m,-2,'2006/5/01'),112),1,6) AS MAE2,
SUBSTRING(CONVERT(char,DATEADD(m,-1,'2006/5/01'),112),1,6) AS MAE1,
SUBSTRING(CONVERT(char,DATEADD(m,0,'2006/5/01'),112),1,6) AS TOU,
SUBSTRING(CONVERT(char,DATEADD(m,1,'2006/5/01'),112),1,6) AS ATO1,
SUBSTRING(CONVERT(char,DATEADD(m,2,'2006/5/01'),112),1,6) AS ATO2,
SUBSTRING(CONVERT(char,DATEADD(m,3,'2006/5/01'),112),1,6) AS ATO3,
SUBSTRING(CONVERT(char,DATEADD(m,4,'2006/5/01'),112),1,6) AS ATO4,
SUBSTRING(CONVERT(char,DATEADD(m,5,'2006/5/01'),112),1,6) AS ATO5,
SUBSTRING(CONVERT(char,DATEADD(m,6,'2006/5/01'),112),1,6) AS ATO6
【結果】
200511 200512 200601 200602 200603 200604 200605 200606 200607 200608 200609 200610 200611
参考
http://oshiete1.goo.ne.jp/kotaeru.php3?q=1310728
http://www.syswat.com/sqltips.html#tpc5020