字符串相加要用CONCAT函数 update matriculater set numberid=CONCAT('0'+numberid) where length(numberid)='8'
update matriculater set numberid=CONCAT('0',numberid) where length(numberid)='8'要逗号,不要加号
这是CONCAT的用法:CONCAT(str1,str2,...) Returns the string that results from concatenating the arguments. Returns NULL if any argument is NULL. May have more than 2 arguments. A numeric argument is converted to the equivalent string form: mysql> SELECT CONCAT('My', 'S', 'QL'); -> 'MySQL' mysql> SELECT CONCAT('My', NULL, 'QL'); -> NULL mysql> SELECT CONCAT(14.3); -> '14.3'
update matriculater set numberid=CONCAT('0'+numberid) where length(numberid)='8'
Returns the string that results from concatenating the arguments. Returns NULL if any argument is NULL. May have more than 2 arguments. A numeric argument is converted to the equivalent string form: mysql> SELECT CONCAT('My', 'S', 'QL');
-> 'MySQL'
mysql> SELECT CONCAT('My', NULL, 'QL');
-> NULL
mysql> SELECT CONCAT(14.3);
-> '14.3'