聆雨亭

浅滩拾遗 - mysql通过字符串函数更新

2015-11-24

阅读:

字数:457


“test-jb-setup”

问题提出

希望将用户手机号最后4位加一个固定的字符串,生成用户的昵称

解决方案

update `tuser` set `nickname` =  CONCAT("会员" , substr(`mobilephone`, 8,4))  where nickname is null or `nickname` like '会员%'

Comments

Content