MySQL to Clear up old ticketdata Database in Labtech Automate

DELETE FROM tickets WHERE updatedate < DATE_ADD(NOW(),INTERVAL - 30 DAY); 
DELETE FROM ticketdata WHERE ticketid NOT IN ( SELECT ticketID FROM tickets );
DELETE FROM timeslips WHERE ticketid NOT IN ( SELECT ticketID FROM tickets ); 
DELETE FROM Databasefails WHERE ticketid NOT IN ( SELECT ticketID FROM tickets );
DELETE FROM Databasealerts WHERE ticketid NOT IN ( SELECT ticketID FROM tickets ); 
DELETE FROM plugin_cw_ticket_failures WHERE ticketid NOT IN ( SELECT ticketID FROM tickets );
 DELETE FROM Projects WHERE ticketid NOT IN ( SELECT ticketID FROM tickets );
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...