[thelist] mysql-changing some but not all info in a column
Anne Thorniley
anne at beerintheevening.com
Mon Sep 9 06:02:01 CDT 2002
Try using the REPLACE function:
REPLACE(str,from_str,to_str)
Returns the string str with all all occurrences of the string from_str replaced by the string to_str:
mysql> select REPLACE('www.mysql.com', 'w', 'Ww');
-> 'WwWwWw.mysql.com'
so in your case, something like
update this_table set url=replace(url, 'domain.com', 'newdomain.com.au');
Cheers,
Anne
On Mon, Sep 09, 2002 at 09:00:38PM +1000, Adrian Fischer wrote:
>
> Greetings all,
>
> I have a mysql db and in one of the columns I have a url to an image. I
> need to change the domain part of the url. The rest remains the same.
>
> so...
>
> http:/domain.com/images/nicepic.gif
>
> becomes
>
> http://newdomain.com.au/blah/blah
>
> There is about 700 records to change. Time consuming if I have to do it by
> hand to say the least.
>
> Any Ideas would be appreciated
>
> Regards
>
> Adrian Fischer
>
> --
> For unsubscribe and other options, including
> the Tip Harvester and archive of thelist go to:
> http://lists.evolt.org Workers of the Web, evolt !
--
people...
you can never change the way they feel
better let them do just what they will
More information about the thelist
mailing list