[thelist] mysql-changing some but not all info in a column

Katherine Spice k.spice at acu.ac.uk
Mon Sep 9 08:19:00 CDT 2002


Hi Adrian,

> http:/domain.com/images/nicepic.gif
>
> becomes
>
> http://newdomain.com.au/blah/blah

Try this - add a new column to the table (newdomaincolumn) and then run

update tablename set
newdomaincolumn=CONCAT("http://newdomain.com.au",SUBSTRING(olddomaincolumn,16));

where 16 is the number or characters in http:/domain.com. Then you can
drop olddomaincolumn and rename newdomaincolumn as the old one.

HTH,
Katherine



More information about the thelist mailing list