Created
February 16, 2015 06:04
-
-
Save sc0ttkclark/c8f8b4d009442057c896 to your computer and use it in GitHub Desktop.
Delete all GF lead data if lead has been deleted
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELETE | |
lead_detail | |
FROM | |
wp_rg_lead_detail AS lead_detail | |
LEFT JOIN | |
wp_rg_lead AS lead ON lead.id = lead_detail.lead_id | |
WHERE | |
lead.id IS NULL; | |
DELETE | |
lead_detail_long | |
FROM | |
wp_rg_lead_detail_long AS lead_detail_long | |
LEFT JOIN | |
wp_rg_lead_detail AS lead_detail ON lead_detail.id = lead_detail_long.lead_detail_id | |
WHERE | |
lead_detail.id IS NULL; | |
DELETE | |
lead_meta | |
FROM | |
wp_rg_lead_meta AS lead_meta | |
LEFT JOIN | |
wp_rg_lead AS lead ON lead.id = lead_meta.lead_id | |
WHERE | |
lead.id IS NULL; | |
DELETE | |
lead_notes | |
FROM | |
wp_rg_lead_notes AS lead_notes | |
LEFT JOIN | |
wp_rg_lead AS lead ON lead.id = lead_notes.lead_id | |
WHERE | |
lead.id IS NULL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment