56,681
社区成员
发帖
与我相关
我的任务
分享
update tablename set record_id=concat(name,"-",date."-",replace(str(id,3),' ','0'));
全表更新表名为tablename的表。
concat(str1,str2,...) 连接多个字符串;
replace(str(id,3),' ','0') 先将字段id转换为3位的str类型字符,然后将其中的 ' ' (空字符) 转换为0,实现数字转固定长度字符串,不足长度补0,如1转换为001。