'How to schedule MYSQL Event on Specific Datetime?
I am facing an issue want to updating the message table column DateTime using the MySQL event scheduler On DateTime '2022-02-23 23:58:00' where status is open and mes_type is SSG. Please help me to correct my code I will be thankful to you.
DELIMITER $$
CREATE EVENT my_event
ON SCHEDULE AT '2022-02-24 23:58:00'
DO
UPDATE MESSAGE
SET datetime = '2022-03-01 23:59:00'
WHERE datetime = '2022-02-23 23:59:00'
AND STATUS = 'OPEN' and MES_TYPE = 'SSG'
END */$$
DELIMITER ;
Solution 1:[1]
You have only 1 statement so you don't need to set delimiters and the end statement is unnecessary but you do need to terminate the update
CREATE EVENT my_event
ON SCHEDULE AT '2022-02-24 23:58:00'
DO
UPDATE MESSAGE
SET datetime = '2022-03-01 23:59:00'
WHERE datetime = '2022-02-23 23:59:00'
AND STATUS = 'OPEN' and MES_TYPE = 'SSG';
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | P.Salmon |
