MISMONTH SRIMONTH 20160229 201511 20160229 201601 20160229 201602 20160229 201512
select * from MyTable where SRIMONTH = Left(MISMONTH,6)
SELECT CAST(MISMONTH As DateTime) as MisMonth, (YEAR(DateADD(mm, -2, CAST(MISMONTH As DateTime)) * 100) + (MONTH(DateADD(mm, -2, CAST(MISMONTH As DateTime))) as SRIMonth From MyTable
select * from MyTable where SRIMONTH >=convert(varchar(6),DATEADD(MONTH,-2,convert(datetime,MISMONTH)),112)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)