Can you explain the relationship between #_eb_field_values , #_eb_events and #_eb_registrants?
So if i delete all events and registrants before 2017 how can i then delete the field values related to those specific events and registrants?
#_eb_field_values is 24mb and only has:
id
registrant_id
field_id
field_value
I cant seem to find a relationship?
#_eb_field_values
registrant_id is FK to
#_eb_registrants
id
Here is the Delete statements to remove records prior to 2018
Step 1:
D ELETE F ROM `#_eb_events` W HERE `event_date` < "2018-12-31 00:00:00";
Step2:
D ELETE F ROM `#_eb_registrants` W HERE `event_id` NOT IN ( S ELECT `id` F ROM `#_eb_events`)
Step3:
D ELETE F ROM `#_eb_field_values` W HERE `registrant_id` NOT IN ( S ELECT `id` F ROM `#_eb_registrants`);
Success consists of going from failure to failure without loss of enthusiasm.
Last edit: 4 years 8 months ago by OTWD. Reason: worked it out myself