PDA

View Full Version : Resolved Altering existing data...


greens85
10-27-2009, 03:46 PM
Hi all,

I recently (wrongly) appended some data using the concat() function... my data now reads http://www.website.comhttp://

Is there any way to strip off both the instances of http:// without altering the records one by one???

Thanks

CFMaBiSmAd
10-27-2009, 03:54 PM
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace

greens85
10-27-2009, 04:03 PM
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace

From reading that I would guess it would be something like this:

SELECT REPLACE ('http://', '');

But im not sure how to link that in with the correct database & field....

CFMaBiSmAd
10-27-2009, 04:08 PM
UPDATE your_table SET your_column = REPLACE(your_column, 'http://', '');

greens85
10-27-2009, 04:17 PM
UPDATE your_table SET your_column = REPLACE(your_column, 'http://', '');

I was quite some way off.... but thats done it...

Many thanks for your help! :thumbsup: