I am trying to subtract a month from a YearMonth format. YYYYMM YearMonth is is varchar format.
So I do :
The problem is when get to 200601 it returns 200600 instead of 200512
Any suggestion how to fix this?
To do date arithmetic on the field, you need to turn it into a date
Follow this code
I first string concatenate a '01' to make a string that matches the date format of 112 (ISO standard). Then I can convert that to an actual date, then subtract one month using
The last one is the one you need, but I've shown the intermediary steps to help you understand the path....