update table set field=concat(field, '072110003') where field='072110001';在两个号码中间用空格隔开,则可以用update table set field=concat(' ', field, '072110003') where field='072110001';

解决方案 »

  1.   

    update table set field=concat(' ', field, '换成一个变量') where field='072110001'; 
    这样不就可以了么?如果要追加多个,可以把SQL写入循环里.
      

  2.   

    汗,刚发现帖出来的sql里面有个地方错了。
    update table set field=concat(' ', field, '072110003') where field='072110001'; 
    应该是
    update table set field=concat_ws(' ', field, '072110003') where field='072110001'; 
    或者
    update table set field=concat(field, ' ', '072110003') where field='072110001'; 
    对于需要一次添加多个值,并且都用' '隔开的话,用第二条语句比较方便。 一次只用一个的话,concat比较简单而且不同数据库通用。
      

  3.   

    在问一个相反的问题,如何从这个字段里去掉部分值,
    比如说现在是“072110002 072110003”,我要去掉072110003或者是去掉072110002,应如何实现?
    应该也是用update吧,还是用delete?
      

  4.   

    update table set field=replace(field, '072110003', '') where field='072110001 072110003';