Update date + one year in mysql

Bajlo picture Bajlo · Oct 5, 2010 · Viewed 111.2k times · Source

When I want setting numerical value +1 in mysql table, I use e.g.:

UPDATE table SET number=number+1 WHEN ...

How can I set date + one year?

Thanks

Answer

Julien Hoarau picture Julien Hoarau · Oct 5, 2010

You could use DATE_ADD : (or ADDDATE with INTERVAL)

UPDATE table SET date = DATE_ADD(date, INTERVAL 1 YEAR)