gpt4 book ai didi

MySQL 更新时出现错误 1064,但查询看起来正确

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

我不确定这里发生了什么

mysql> update messages set read=1 where id=4;
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 'read=1 where id=4' at line 1

mysql> show columns from messages;
+-------------------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+---------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| account_id | varchar(255) | NO | | NULL | |
| subject | varchar(2048) | NO | | NULL | |
| message | text | NO | | NULL | |
| message_id | int(11) | NO | | 0 | |
| read | int(11) | NO | | 0 | |
| replied | int(11) | NO | | 0 | |
| priority | int(11) | NO | | 0 | |
| topic | int(11) | NO | | 0 | |
| user_deleted | int(11) | NO | | 0 | |
| created | datetime | NO | | NULL | |
| modified | datetime | NO | | NULL | |
| to_user_id | int(11) | NO | | 0 | |
| recipient_deleted | int(11) | NO | | 0 | |
| recipient_read | int(11) | NO | | 0 | |
+-------------------+---------------+------+-----+---------+----------------+
15 rows in set (0.00 sec)

关于如何更新消息表的已读列有什么想法吗?

最佳答案

您可以尝试以下 - 您需要使用反引号``作为保留关键字

update messages set `read`=1 where id=4;

关于MySQL 更新时出现错误 1064,但查询看起来正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53628800/

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