开发者社区 问答 正文

mysql如何利用现在的值来更新另外一列的值?报错

现在有一张表vipcustomer,其中有一个字段为customerno,这一列是有值的,比如1、2、3、4、5、6等,还有一个字段为vipcustomerno,这一列目前是没有值的,现在更新这一列的值,规则为customerno的值前面加上10000,比如1变成100001,2变成100002,3变成100003等,我现在的sql语句为:UPDATE TABLE vipcustomer SET customervipno = '10000' + customerno

但是报错了,[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TABLE vipcustomer SET customervipno = '10000' + customerno' at line 1

小弟刚接触数据库,不明白为什么这样不行,向各位高手请教

展开
收起
爱吃鱼的程序员 2020-06-22 19:12:27 474 分享 版权
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    <spanstyle="font-size:14px;line-height:22px;">多了一个TABLE,去掉试试,还有加的值不要打引号嗯,已经可以了,确实多了个TABLE,不过后面不是加的值,而是字符串连接,所以那个引号不能去年,3Q!

    2020-06-22 19:12:45
    赞同 展开评论