I need an event that subtracts the current date from a specific date entered.
However, I am working with a criteria of 1 month, if the result of the subtraction is greater than 1 months then update a table with value '1'. So it would Be Current_date- receipt_date
, and if this is greater than 1 months then update flag to be '1' else '0'.
I want it to run every minute.
Here's my code so far:
CREATE EVENT myevent3
ON SCHEDULE EVERY '1' MINUTE
DO
UPDATE lms.receipt
SET delinquent = (
CASE WHEN DATE_ADD( receipt_date, INTERVAL 1 MONTH ) < NOW()
THEN 1
ELSE 0
END
);