I have a table here which has values of year in the yy format. The column itself is an int.
Now, there is a need to convert the values into yyyy format. So for ex. 12 will become 2012. 1 will become 2001.
I looked at convert and decode functions, but I am not sure if that will help. Could you please guide me on how I could do this on mysql ?
If you do have years from the 1900s you can use the following:
The switch is up to you, and you will run into problems if you have a century worth of data. Then again, if this application still runs in 70 years then you will have archived / deleted older data and the switch can be increased.
Thanks a lot for the reply. I just have the years from 2000 onwards, thankfully.
I just couldnt think it was as simple as adding 2000 to the values. lol
Since this change will go up a sql which is bound to be run again and again. I just wanted to be sure that I do not end up adding 2000 everytime the query is run.
I am a little lost on this simple query. I was thinking in the lines of the below, but I am obviously wrong :