I'm not sure what you mean by: "This will give the latest 12 months in the table."Here is way to do the conversion to get the Year_Month 13 months prior:DECLARE @Yak TABLE (YearMonth VARCHAR(6))INSERT @YakSELECT '200905'UNION ALL SELECT '200901'UNION ALL SELECT '200904'UNION ALL SELECT '200903'UNION ALL SELECT '200812'UNION ALL SELECT '201001' -- Max for testing JanSELECT CONVERT(VARCHAR(6), DATEADD(MONTH, - 13, CAST(MAX(YearMonth) + '01' AS DATETIME)), 112) AS NewDateFROM @Yak