List:General Discussion« Previous MessageNext Message »
From:Daevid Vincent Date:March 15 2007 8:13am
Subject:RE: Possible in sql, or just move it to a language
View as plain text  
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:lists@stripped] 
> Sent: Thursday, March 15, 2007 12:20 AM
> To: mysql@stripped
> 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/mysql?unsub=1
> 
> 

Thread
Possible in sql, or just move it to a languageScott Haneda15 Mar
  • RE: Possible in sql, or just move it to a languageDaevid Vincent15 Mar