PDA

View Full Version : mysql merge values



tocleora
January 9th, 2007, 05:27 PM
I have a date field that some of the dates have a year of 2007. I want to change those 2007's to 2006's. I was thinking something like this:


update employees set dateofhire = '2006' & right(dateofhire,6) where dateofhire > curdate()

But I'm going to guess that's not the right syntax. Doing a search for right on mysql.org pulls several different results. Can anyone give me the proper syntax? TIA...

marianom
January 9th, 2007, 06:06 PM
I would just add a whole year with dates arithmetic as seen here: http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

tocleora
January 9th, 2007, 06:18 PM
That'll do! Thanks!