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

后端 未结 4 1826
一向
一向 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:47

    UPDATE Table SET Field=CONCAT(IFNULL(Field, ''), 'Your extra HTML')

    If the field contains NULL value then CONCAT will also return NULL. Using IFNULL will help you to update column even it has NULL value.

提交回复
热议问题