MySQL Forums
Forum List  »  Events (Job Scheduler)

Re: MySQL Events: How to schedule commands for every 1st day of the month?
Posted by: Cesar Murilo Cesar
Date: November 12, 2019 12:43PM

Does this event below not work?

CREATE EVENT ev_radacct_cpmonth EVERY MONTH
DO
START TRANSACTION;
SET @radacct_pmonth:=(SELECT CONCAT('radacct_',YEAR(NOW()),MONTH(NOW())-1) AS radacct_pmonth);
CREATE TABLE IF NOT EXISTS @radacct_pmonth SELECT * FROM RADACCT;
DELETE FROM radius.radacct WHERE accstoptime < date_sub(NOW(),INTERVAL 1 MONTH);
OPTIMIZE radius.raddacct;
COMMIT;

I will test the commands yet. I'm new to MySQL and I have this difficult mission in the company. Please help me, please.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: MySQL Events: How to schedule commands for every 1st day of the month?
289
November 12, 2019 12:43PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.