|
Update a field, add a value or string after it, and get this field value without querying the database How to add it? user table, with two fields name [string] and age [int] 1. You need to add a unified logo in front of each name, such as: whh to user_whh 1. You need to add 5 years to each age, such as 20 to 25 Note!! Numbers can be directly connected with the '+' sign Strings must be concat, rules:(1)CONCAT(str1,str2,...) #返回结果为将参数相连后得到的字符串. If any of the parameters are NULL, the return value is NULL. Perhaps there is one or more parameters. #如果所有参数均为非二进制字符串, the result is a non-binary string. If the argument contains either binary string, the result is a binary string. #一个数字参数被转化为与之相等的二进制字符串格式; To avoid this, you can use explicit types. (2)CONCAT_WS() #UPDATE user set name=CONCAT_WS('_','user',name) #字段原值为:jack will output a user_jack, note that the first parameter is a connector.
|