gpt4 book ai didi

更新多列时MySQL错误1064

转载 作者:行者123 更新时间:2023-12-01 00:25:02 24 4
gpt4 key购买 nike

我有以下 SQL 查询:

UPDATE mytable SET status = '2', dec = '268435458001932988' WHERE id = 29952

表是:

status = varchar(1)
dec = varchar(23)

在阅读手册后,我可以通过用“,”分隔它们来更新多个列。

那么为什么我会在这里收到语法错误 (1064)?

#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 'dec = '268435458001932988' WHERE id = 29952' at line 1

最佳答案

DEC 显然是 MySQL 中的保留字。使用反引号。

UPDATE Mytable SET status = '2', `dec` = 'etc.'...

保留字列表:https://dev.mysql.com/doc/refman/4.1/en/reserved-words.html

关于更新多列时MySQL错误1064,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15867404/

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