Take a look at using a regular expression in the where clause of the 
UPDATE SQL statement to match them.

http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#IDX1206 
http://www.mysql.com/documentation/mysql/bychapter/manual_Regexp.html#Regexp

 From there, MySQL's string functions - LOCATE() to find the domain 
you want to replace, inside a SUBSTRING function to pull out just the 
'email1@' part, inside a CONCAT() function to append the new domain 
onto the end.

http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#String_functions

Its not too hard once you play with the string functions a little bit 
- be careful and make a table with some test data before doing it on 
the real data.

-rh

>Hello all,
>
>I've got some e-mails addresses on an e-mails database where one domain has
>been changed to another.
>
>So I have :
>
>email1@domain1
>email2@domain1
>
>I need to change @domain1 to @domain2 on this e-mail field and keep the user
>name.
>
>Some e-mails of an specific ISP had their domains changed but the usernames
>remained the same. So I need to update this table that has some hundreds
>addresses of this particular domain that had been changed.
>
>Is there any way to do it through a SQL statement?
>
>Thank you,
>
>Carlos Fernando.
>
>
>Linux User #207984
>
>
>---------------------------------------------------------------------
>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


---------------------------------------------------------------------
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