I have an updated_at
field that was not initially set with default datetime value on the server. For a short period, a bunch of records got inserted with an "empty" value and are showing up at 0000-00-00 00:00:00
in the updated_at
column. I wrote am update command to copy the values of the created_at
field to updated_at
and it is updating the field correctly, however, when I run it in MySQL Workbench, I get the following warning:
6 row(s) affected, 1 warning(s): 1292 Incorrect datetime value: '' Rows matched: 6 Changed: 6 Warnings: 1
My query:
UPDATE mytable
SET updated_at=created_at
WHERE updated_at='' and id >0;
I'm not sure where that warning is coming from since the created_at
times are all valid and the updated_at
fields are being set with the correct data.