Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Appending data to a MySQL database field that already has data in it

I need to "add" data to a field that already contains data without erasing whats currently there. For example if the field contains HTML, I need to add additional HTML to the field. Is there a SQL call that will do this or do I need to call the data in that field, concatenate the new data to the existing data, and reload it into the database?

like image 398
Graham Avatar asked May 03 '10 22:05

Graham


People also ask

How can I append a string to an existing field in MySQL?

To prepend a string to a column value in MySQL, we can use the function CONCAT. The CONCAT function can be used with UPDATE statement.

How do I add data to an existing database?

Simple INSERT statement to add data to the table. Use INSERT Statement to add multiple rows in the table. INSERT INTO SELECT clause to insert the output generated by the SELECT query. INSERT IGNORE clause to ignore the error generated during the execution of the query.

Which MySQL function can be used to add text to an existing value?

Which MySQL function can be used to add text to an existing value? We can append a string of data to an existing data of a field by using concat function of MySQL.


1 Answers

UPDATE Table SET Field=CONCAT(Field,'your extra html'); 
like image 143
Mitch Dempsey Avatar answered Sep 21 '22 03:09

Mitch Dempsey