I'm just guessing at this, but I think this is a simple update:

UPDATE  table1, table2 
SET       table2.needs_purging = 1
WHERE   table1.bounce_email = table2.email

http://dev.mysql.com/doc/refman/5.1/en/update.html

You could also do this same logic with the delete I believe:

DELETE table2
FROM     table1, table2
WHERE  table1.bounce_email = table2.email

http://dev.mysql.com/doc/refman/5.1/en/delete.html


> -----Original Message-----
> From: Scott Haneda [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, March 15, 2007 12:20 AM
> To: mysql@lists.mysql.com
> Subject: Possible in sql, or just move it to a language
> 
> This is a one off I need to do
> 
> Table1 has email addresses in it, table two also has email 
> addresses in it.
> table1 represents bounced emails that need to be purged from 
> the database.
> 
> What I would like to do, is mark a field in table2, called 
> "needs_purging"
> to true, when there is a match from table 1
> 
> Should I just run a loop in my language of choice, or is 
> there a join I am
> not seeing here?
> -- 
> -------------------------------------------------------------
> Scott Haneda                                Tel: 415.898.2602
> <http://www.newgeo.com>                     Novato, CA U.S.A.
> 
> 
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    
> http://lists.mysql.com/[EMAIL PROTECTED]
> 
> 


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to