Reputation:
I'm Writing Mysql Query's
I am currently comparing dates using the between function.
UPDATE TOTAL2
SET CHARGE = 'O'
WHERE STARTDAY BETWEEN DATE_FORMAT('2020-02-27 00:00:00', '%Y-%m-%d %h:%i:%s') AND DATE_FORMAT('2020-03-31 00:00:00', '%Y-%m-%d %h:%i:%s')
AND ENDDAY IS NULL;
I wrote the update query above, but due to a coincidence, the value of the STARTDAY column included '2020-02-27 00:00:00', so the corresponding row was not reflected.
How do I modify the query to include that part as well?
Upvotes: 0
Views: 66
Reputation: 129
This way you can get desired result:
UPDATE
TOTAL2
SET
CHARGE = 'O'
WHERE
STARTDAY BETWEEN '2020-02-27 00:00:00'
AND '2020-03-31 00:00:00'
AND ENDDAY IS NULL;
Upvotes: 0