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

后端 未结 4 1811
一向
一向 2020-12-04 23:45

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

4条回答
  •  一整个雨季
    2020-12-05 00:43

    Append at the end of a field, separated with with a line break:

    UPDATE Table SET Comment = CONCAT_WS(CHAR(10 USING UTF8), Comment, 'my comment.');
    
    • CONCAT_WS() appends multiple strings separated by a given separator.
    • CHAR(10, UTF8) is a line break.

提交回复
热议问题