5

I have a table with 5 million DATETIME records. I want to add a year to all the various datetimes in the table. Can I do it all with a single query? Something like:

SELECT DATE_ADD(*, INTERVAL 1 YEAR);

Or any other way you would recommend. Thanks!

Question Overflow
  • 10,925
  • 18
  • 72
  • 110

1 Answers1

9

This should do what you want:

UPDATE table SET datefield = DATE_ADD(datefield, INTERVAL 1 YEAR);

If you need to update every table in the database check the answers to this question

Community
  • 1
  • 1
Pastor Bones
  • 7,183
  • 3
  • 36
  • 56