gpt4 book ai didi

mysql - 当我尝试将行更新到表时,出现以下错误 :

转载 作者:行者123 更新时间:2023-11-29 19:09:55 25 4
gpt4 key购买 nike

mysql> select * from GSLAB;
+--------+--------------+
| empid | destignation |
+--------+--------------+
| GS101 | Manager |
| GS102 | ABC |
| GS-103 | SAS |
| GS-104 | dsSAS |
| GS105 | EWSAS |
| GS106 | EWQAS |
+--------+--------------+
6 rows in set (0.00 sec)

mysql> update GSLAB set empid= substr(empid,4,15)||substr(empid,1,2)||'-' where empid substr(empid,1,3)<>'-';
ERROR 1064 (42000): 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 'substr(empid,1,3)<>'-'' at line 1
mysql>

最佳答案

我使用 concat 函数而不是 concat 运算符“||”

mysql> 更新 GSLAB set empid= concat(substr(empid,1,2),'-',substr(empid,4,15)) 其中 substr(empid,1,3)<>'-';

关于mysql - 当我尝试将行更新到表时,出现以下错误 :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43169195/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com