I have created an event in HeideSQL. i just wanna change a value in a table if the value is 2 to 0 after 3 minutes of data insertion. I can execute the query. But i wanna make it automatic. so I created an event. but it is not working automatically. Could someone please help.
Settings as follows:
Name: changeValueEvent Definer: root@localhost Drop event after expiration : checked ( tried unchecked as well) state: enable
Timing:
every: 2 Minutes starts at : 04/01/2019 2:00:00 PM
executing body:
BEGIN
    UPDATE data SET data.VALUE = 0
        WHERE data.TIME <= date_sub(NOW(), interval 3 MINUTE)
          and data.VALUE = 2;
END
    //data is the name if table
    //wanna update VALUE column. 
    //TIME column carries the time of data 
    BEGIN
        UPDATE data SET data.VALUE = 0
            WHERE data.TIME <= date_sub(NOW(), interval 3 MINUTE)
              and data.VALUE = 2;
    END