0
I’m trying to create an event to delete lines, that column date
is expired, or is less than the current date.
I was trying with the following command:
create event e on schedule every 1 day do delete from Reserve where date < curdate();
But then I was testing it by adding a line with an old date and changing the every 1 day
for every 1 second
But I didn’t succeed...
Could someone help me with the correct query for my problem?
Try Where trunc(date) < kurdate(). Or, see if the format of your field date is equal to the output of kurdate.
– Diego
If you try some other event or a different parameter for Where, it executes?
– Leonardo Coelho
I couldn’t, @Diego. And yes, the format used is the same.
– Naldson
@Leonardocoelho I tried with other parameters, but I did not succeed either...
– Naldson
it is good to use Cronjob for things like these.
– Raphael Caldas