Level 73
You need to wrap the where date_created in a data function as well like you do in the select query.
UPDATE `message` SET `date_created` = '2021-05-22 13:34:17' WHERE DATE(`date_created`) = DATE('2021-06-06')
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello Guys,
I have about 600 rows that contain the same date but different timestamps (Hour, min, second ). When I run this query, I find all the ones I need to update
SELECT * FROM `message` where DATE(`date_created`) = DATE('2021-06-06')
I would like to update all of the rows with a new time stamp like 2021-05-22.
I tried this query but didn't work
UPDATE `message` SET `date_created` = '2021-05-22 13:34:17' WHERE `date_created` = DATE('2021-06-06')
Any ideas?
Thanks
Please or to participate in this conversation.