I want to delete the all closed tickets which are older than 2021 using sql query which i directly run in database , but i also want to delete the all associated data which are in other table
my current query :
SELECT ost_ticket.*
FROM ost_ticket
JOIN ost_ticket_status ON ost_ticket_status.id = ost_ticket.status_id
WHERE YEAR(ost_ticket.closed) < 2021;
Help me..