This question already has an answer here:
I'd like to perform a find & replace in MySQL in GoDaddy's phpMyAdmin tool.
My table is called "wcswcd_posts", and I would like to find a URL, like:
http://wordpress.woodswcd.com/wordpress/wp-content/uploads/2013/11/drill.jpg
And replace it with:
/wordpress2/wp-content/uploads/2013/11/drill.jpg
Just not sure of what the syntax would be.
Thank you.
</div>
You are going to need to use the UPDATE
statement & the REPLACE
function
to change it try:
UPDATE wcswcd_posts SET url = REPLACE(url,'http://wordpress.woodswcd.com','')
REPLACE
is a string function that replaces every occurrence of the 2nd string in the 1st string with the 3rd one.
By setting the 3rd argument in the REPLACE
function to nothing, you will get rid of any occurence of http://wordpress.wordswcd.com
leaving /wordpress/wp-content/uploads/2013/11/drill.jpg
This link should get you started.
Just replace http://wordpress.woodswcd.com/wordpress/
with http://wordpress.woodswcd.com/wordpress2/