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
UPDATE  QA_BUGLIST SET BUG_TASK_NUM =  
CASE (BUG_ID %13) WHEN 0 THEN 'TASK#201913'
ELSE CONCAT('TASK#1110',BUG_ID %13) END 

  

posted @ 2019-02-14 10:06  巴黎爱工作  阅读(3603)  评论(0编辑  收藏  举报