wright67uk Posted May 26, 2012 Share Posted May 26, 2012 how can I append a text string to each row in a column? I have a database with several columns; ID, name, product, product_id, description etc. the description column is made of BLOBS. I need to add the same string of text to the end of each description in my table. " </p> </p> This tree has been recently potted at the end of bare root season. " Is this possible to do using 1 sql query? I only have 20 or so products in this table so I could do this manually 20 times, but I thought it would be useful to know, especially if I have to add text to a table someday with 500 products in. Quote Link to comment Share on other sites More sharing options...
Barand Posted May 26, 2012 Share Posted May 26, 2012 UPDATE mytable SET description = CONCAT(description, ' </p> </p> This tree has been recently potted at the end of bare root season. '); Quote Link to comment Share on other sites More sharing options...
wright67uk Posted May 27, 2012 Author Share Posted May 27, 2012 Perfect, Thankyou! For future reference , is this possible? eg. if later in the year I want to change " </p> </p> This tree has been recently potted at the end of bare root season. " to " </p> </p> This tree is a bare root product. " how can i search for the mentioned text string and change only that text string without effecting any text before it? Quote Link to comment Share on other sites More sharing options...
Barand Posted May 27, 2012 Share Posted May 27, 2012 MySQL has a REPLACE function Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.