About mysql stitching symbol "+" sign error

In the project we need to add all 123 characters of each user's phone behind

I take his own account to do the test, using the "+" symbol splicing 

Mobile = Mobile UserInfo the SET Update + '123' = the WHERE USID 2673
13,517,363,148
become
13,517,363,271
Why not 13,517,363,148,123 it?

In the field of mobile type is the database type varchar, but this time not only a telephone number into a numeric type, but also to '123' into a numeric type and are added, so the switching operation of the own database, confirms the " + "symbol is not spliced, but the operator

 

Use the keyword concat

update userinfo  set mobile = concat(mobile, '123') where usid  = 2673

Successful, the concat brackets, there may be a plurality of addition, Example: concat ( '1', '2', '3' ...);

 

Now that the data can be automatically converted, so I tried it, the column is not numeric characters, such as name, name of the field, the result of error, as follows:

update userinfo  set uname = uname + '123' where usid  = 2673
> 1292 - Truncated incorrect DOUBLE value: '莫闲'
> 时间: 0.001s

 

Guess you like

Origin blog.csdn.net/u011719228/article/details/93969496