On Thursday 28 February 2002 3:47 pm, Eric Colley wrote:
> I have a MySQL table of basic user information including email address as
> one of the fields.  The table is about at the 10,000 record mark.  I have a
> list of bad email addresses that another program found for me (around 2,000
> records).  Now how do I take this list of bad email addresses and run a
> command or macro of some sort that will delete all the records in the table
> with the email field equal to each one of those bad emails?  Anyone have a
> suggestion for me?

Okay.

You'd normally do this with a subquery but MySQL does not support them.  If 
you check the docs, you'll see that there's an example of how to delete stuff 
without using subqueries.  Basically, you do it programmatically.  Here's the 
pseudocode:

list <-- dbQuery("SELECT * FROM BadList")
for each element in list
        dbQuery("DELETE FROM GoodList WHERE GoodList.id = " + element.id)

I've done this in C++, you might want to use some other language.

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to