MySQL, UPDATE data into a database using CONCAT()

To insert data into a MySQL database field while preserving the existing data in that field, simply concatenate the new data to the end of the existing data.

Below is an example of how to do this using the field "changelog".

UPDATE table1 SET changelog = CONCAT(changelog, "new data" ) WHERE id = 'idnumber';

If you would like the data that you are entering to appear at the beginning of the existing data, simply flip the concatenation, example:

UPDATE table1 SET changelog = CONCAT("new data", changelog) WHERE id = 'idnumber';


If you have questions about anything on this site, you can find me on Google+: