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

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?

Yes you can use the following query to append data to database field.

UPDATE Table SET Field=CONCAT(Field,'your extra html');
and you can also do it with specific where condition
UPDATE myTable SET html=concat(html,'<b>More HTML</b>') WHERE id='10' 


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s