First, string concatenation
Demand: account_code original data base to label 'HSJS' in front ......
1) a misuse:
mysql> update tbpayment_settlement set account_code = ('HSJS'+ account_code) where id = 616783; 1292 - Truncated incorrect DOUBLE value: 'HSJS' mysql>
2) misuse II:
mysql> update tbpayment_settlement set account_code = ('1001'+ account_code) where id = 616783; 1292 - Truncated incorrect DOUBLE value: 'HSJS201908' mysql>
supplement:
mysql> select account_code from tbpayment_settlement where id = 616783; +--------------+ | account_code | +--------------+ | 201908 | +--------------+ 1 row in set mysql>
Solution: account_code to varchar type, can not be used '+' to the string concatenation, '+' for numeric type are added. And the string should be used concat (str1, str2, ...) function.
3) the correct answer
mysql> update tbpayment_settlement set account_code = concat('HSJS',account_code) where id = 616783; Query OK, 1 row affected Rows matched: 1 Changed: 1 Warnings: 0 mysql> select account_code from tbpayment_settlement where id = 616783; +----------------+ | account_code | +----------------+ | HSJS201908 | +----------------+ 1 row in set mysql>