【MySQL】字段增加 or 去掉前缀

 

 

一、字段拼接前缀

 

update table_name set col_name = concat('待拼接前缀', col_name)
where ...条件

  

二、字段去除前缀

 

-- 其中 n 为从左边起需要去除字符个数

update table_name set col_name = right( col_name, length(col_name) - n )
where ...条件

  

posted @ 2021-06-28 19:40  winlily  阅读(149)  评论(0编辑  收藏  举报