Reputation: 11275
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!
Upvotes: 5
Views: 3479
Reputation: 7371
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
Upvotes: 9