您可以使用以下内容执行此操作:
SELECT MONTH(DATEADD(mm, -m, GETDATE())) AS m, LEFT(DATENAME(mm, DATEADD(mm, -m, GETDATE())), 3) AS n, YEAR(DATEADD(mm, -m, GETDATE())) AS y FROM (VALUES (0),(1),(2),(3),(4),(5),(6)) t(m)
输出:
m n y 12 Dec 2015 11 Nov 2015 10 Oct 2015 9 Sep 2015 8 Aug 2015 7 Jul 2015 6 Jun 2015