I am new to Teradata. I am having column month1 in YYYYMM format (201601,201602,201603...)and want last three month data. Its work fine with >max(month1)-4, but it is failing for jan month (201601)
Please let me know any different way.
Solved! Go to Solution.
You need to cast to a date and then back to a string:
Trim(Add_Months(Cast(col AS DATE Format 'YYYYMM'),-4) (Format 'YYYYMM'))