Create an event to delete from a time

Asked

Viewed 26 times

-1

I have an event that deletes records within the table that runs every 5 minutes.With the following parameters

DELETE FROM redefinirsenha WHERE `Data` < NOW()

But I wanted to make this event run every 1 minute and delete the records that were on the table more than 5 minutes

If anyone can help I’d be very grateful

I’m sorry if the question hasn’t been clarified I’m new here

1 answer

0


You can use the INTERVAL to calculate the 5 minutes in the query:

DELETE FROM redefinirsenha WHERE `Data` < NOW() - INTERVAL 5 MINUTE;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.