MySQL中字符串和数字拼接select * from qa_employ where EMPLOY_GROUP =2
原先雇佣表中所有雇佣姓名全部是"张三",
希望将雇⽤姓名变得不⼀样,⽐如张三+id
SQLserver中直接⽤
update  qa_employ
set EMPLOY_NAME = EMPLOY_NAME+EMPLOY_id
where EMPLOY_ID > 10
即使发现EMPLOY_id是int类型,最多⽤cast转⼀下
update  qa_employ
set EMPLOY_NAME = EMPLOY_NAME+cast (EMPLOY_id as char)
where EMPLOY_ID > 10
但在mySQL报错
1292 - Truncated incorrect DOUBLE value
update qa_employ
set EMPLOY_NAME = concat("开发⼈员",EMPLOY_id)
where EMPLOY_ID > 10
update qa_employ
set EMPLOY_NAME = concat("开发⼈员",EMPLOY_id)
where EMPLOY_ID > 10
mysql 字符串转数组
UPDATE  QA_BUGLIST SET BUG_TASK_NUM =
CASE (BUG_ID %13) WHEN 0 THEN 'TASK#201913'
ELSE CONCAT('TASK#1110',BUG_ID %13) END

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。