Hey Terry,
The below commands are untested, and may not give you your desired result 
- so please read the commands carefully, understand them, backup the 
tables etc before performing it.

Firstly create a temp table with all duplicate email addresses:
create temporary table tmptable select t1.* from news as t1 left join 
members_temp as t2 on t2.email = t1.email where t2.email is not null;

now just delete everything from members_temp that exists in tmptable:
delete from members_temp using tmptable,members_temp where 
members_temp.email = tmptable.email;

optionally drop the temp table:
drop temporary table tmptable;

Hope this helps.

Regards,

Scott

[EMAIL PROTECTED] wrote on 13/02/2006 12:37:34 PM:

> Hi Sluggers,
> I am trying to write an SQL Statement and require some help. 
> 
> I have sent out a mass email to all the email address’s in table 
> “news”, now that is an old table, and I am required to send out the 
> exact same email to everyone in the “members_temp” table, but I need
> to delete all the people out of the “members_temp” where the email 
> exists in the previous “news” table. 
> 
> I have tried the following statement, it seems to run, but doesn’t 
> delete any records. Im using mysql ver 4.0.25-standard
> 
> delete from members_temp where email like '(select distinct email from 
news)' 
> 
> 
> 
> Terry Denovan

> 
> Express Publications Pty Ltd
> 50 Silverwater Rd
> Silverwater, NSW, 2128 
> 
> [EMAIL PROTECTED]
> 
> Tel: 
> Fax: 
> Mobile: 
> 
> 02-9741-3944
> 02-9741-3997
> 0414-459-775 
> 
> 
> 
> 
> 
> 
> The information contained in this e-mail communication may be 
> confidential. You should only read, disclose, re-transmit, copy, 
> distribute, act in reliance on or commercialise the information if 
> you are authorised to do so. If you are not the intended recipient 
> of this e-mail communication, please immediately notify the sender 
> by e-mail and then destroy any electronic or paper copy of this message.
> 
> Any views expressed in this e-mail communication are those of the 
> individual sender, except where the sender specifically states them 
> to be the views of Fexious Pty Ltd. Fexious Pty Ltd does not 
> represent, warrant or guarantee that the integrity of this 
> communication has been maintained nor that the communication is free
> of errors, virus or interference.
> 
>  -- 
> SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
> Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to