我尝试在 mysql 客户端中使用简单的 sql 查询来更新名为“comment”的长文本类型字段,如下所示:
Update mytable set comment='Test' where id = 1;
但我收到此错误
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 'comment='Test' where id = 1' at line 1
我错过了什么吗?提前谢谢。
最佳答案
评论
是reserved word ,如果您想要具有该名称的表/字段,则必须引用它(或者在字段的情况下使用 table.fieldname
语法)。 mysql 中的默认值是反引号,因此:
update mytable set `comment`='Test' where id = 1;
关于mysql - 更新mysql中的长文本字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38852707/