ncomper
asked on
MY SQL Delete with Inner Join
HI, I have a query below which basically finds duplicates email addresses across 2 tables. The results of this I would like to delete from the em_exclusion table. I.e for every row that is returned from the below query I would like to delete from the exclusion table any row that has an email address duplicate with the em_subscriber table.
I have googled around for this and watched YouTube videos and cant find anything on deleting the results of an "Inner Join"
select * from activecampaign.em_exclusio n
Inner join activecampaign.em_subscrib er
ON em_exclusion.email = em_subscriber.email
Thanks all
I have googled around for this and watched YouTube videos and cant find anything on deleting the results of an "Inner Join"
select * from activecampaign.em_exclusio
Inner join activecampaign.em_subscrib
ON em_exclusion.email = em_subscriber.email
Thanks all
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
Use this statement to delete emails
DELETE activecampaign.em_exclusio n, activecampaign.em_subscrib er from table_name1,table2
where (select * from activecampaign.em_exclusio n inner join activecampaign.em_subscrib er ON em_exclusion.email=em_subs criber.ema il)
Use this statement to delete emails
DELETE activecampaign.em_exclusio
where (select * from activecampaign.em_exclusio
ASKER