0

I need to create an MySQL event with multiple deletes.

Content of the event :

delete cfc_registration
from cfc_registration
inner join cfc_tournament
where cfc_registration.cfcTournamentId = cfc_tournament.id and cfc_tournament.createdAt >= DATE_SUB(NOW(),INTERVAL 2 YEAR);

delete cfc_volunteer
from cfc_volunteer
inner join cfc_tournament
where cfc_volunteer.cfcTournamentId = cfc_tournament.id and cfc_tournament.createdAt >= DATE_SUB(NOW(),INTERVAL 2 YEAR);

delete cfc_category
from cfc_category
inner join cfc_tournament
where cfc_category.cfcTournamentId = cfc_tournament.id and cfc_tournament.createdAt >= DATE_SUB(NOW(),INTERVAL 2 YEAR);

delete cfc_wod
from cfc_wod
inner join cfc_tournament
where cfc_wod.cfcTournamentId = cfc_tournament.id and cfc_tournament.createdAt >= DATE_SUB(NOW(),INTERVAL 2 YEAR);

delete cfc_coupon
from cfc_coupon
inner join cfc_tournament
where cfc_coupon.cfcTournamentId = cfc_tournament.id and cfc_tournament.createdAt >= DATE_SUB(NOW(),INTERVAL 2 YEAR);

delete cfc_score
from cfc_score
inner join cfc_tournament
where cfc_score.cfcTournamentId = cfc_tournament.id and cfc_tournament.createdAt >= DATE_SUB(NOW(),INTERVAL 2 YEAR);

delete cfc_score_sheet
from cfc_score_sheet
inner join cfc_tournament
where cfc_score_sheet.cfcTournamentId = cfc_tournament.id and cfc_tournament.createdAt >= DATE_SUB(NOW(),INTERVAL 2 YEAR);

delete cfc_cycle
from cfc_cycle
inner join cfc_tournament
where cfc_cycle.cfcTournamentId = cfc_tournament.id and cfc_tournament.createdAt >= DATE_SUB(NOW(),INTERVAL 2 YEAR);

delete cfc_sale
from cfc_sale
inner join cfc_tournament
where cfc_sale.cfcTournamentId = cfc_tournament.id and cfc_tournament.createdAt >= DATE_SUB(NOW(),INTERVAL 2 YEAR);

delete cfc_tournament
from cfc_tournament
where cfc_tournament.createdAt >= DATE_SUB(NOW(),INTERVAL 2 YEAR);

Issue :

MySQL : #1064 - Error 'delete cfc_volunteer
from cfc_volunteer
inner join cfc_tournament
where cfc_v' line 6
tonymx227
  • 5,293
  • 16
  • 48
  • 91

0 Answers0