MySQL UPDATE append data into column

后端 未结 5 1310
后悔当初
后悔当初 2020-12-08 07:11

I need to UPDATE tablename (col1name)

If there is already data, I need to append it with values \'a,b,c\' If it is NULL, I need to add the values \'a,b,c\'

I

5条回答
  •  粉色の甜心
    2020-12-08 08:03

    Try this Query:

    update tablename set col1name = concat(ifnull(col1name,""), 'a,b,c');
    

    Refer this sql fiddle demo.

提交回复
热议问题