mysql向某一字段追加数据向null字段追加数据

该sql可以向null字段追加数据

update table 
set 字段名=case when 字段名 is not null 
then CONCAT(字段名,"追加的数据") 
else "追加的数据" end 
where id=1;

如果字段默认值为空串可以使用以下sql:

update table 
set 字段名=CONCAT(字段名,"追加的数据") 
where id=1;

case when then else end的初次探索

posted @ 2020-08-28 08:28  zhooke  阅读(25)  评论(0)    收藏  举报