将字符串2008-1减去一个月

CAST(YEAR(DATEADD(dd, 1, DATEADD(mm, - 1, A.COSTMONTH + '-01')
                      - DAY(A.COSTMONTH + '-01'))) AS varchar) + '-' + CAST(MONTH(DATEADD(dd, 1, DATEADD(mm, - 1, A.COSTMONTH + '-01') - DAY(A.COSTMONTH + '-01')))
                       AS varchar)

你可能感兴趣的:(2008)