Im having months in the below format
2012-01
2012-02
2012-03
2012-04
2012-05
2012-06
The months are stored in varchar (i wanted to store only the month). I would like to know how is it possible to subtract the current Y-m along with the months in the database and return the months?
Eg: (2012-11) - (2012-06) = 5
If you want just the months, that’d be a number… why use varchar? int would be better suited.
But since it’s varchar, just use string operations, instead of ugly math:
e.g….
2012-11->11