mysql - 使用过滤器更新 mysql 表时出错

标签 mysql

我有一个 mysql 表,其中包含以下字段:

id, desc, value, people, amount, weight

按照上述顺序,我运行以下命令

update match1 set weight = 5 where desc = 'fat' and id != '6';

以下是我收到的错误消息:

**#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 'desc = 'bat' and id = 6' at line 1

有人可以告诉我这有什么问题吗?

最佳答案

desc是mysql中的关键字。使用反引号,即

where `desc` = 'fat'

关于mysql - 使用过滤器更新 mysql 表时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5692323/

相关文章:

mysql - 从今天早上 5 点开始获取所有 `Timestamp`

sql - 弃用数据库模式中的列的最佳方法是什么?

php - 在谷歌地图中从mysql数据库创建折线

PHP MySQL 自动为具有依赖性的行编号并添加为列

php - 无法吐出 mysqli 随机数

mysql - MySQL 中的文本搜索 - 性能和替代方案

mysql - 查询多个表,但从任何一个表获取结果,无需 JOIN mysql

jquery - Bootgrid 求和列并在页脚中显示结果

php - 从网站头部的数据库中获取数据

mysql - while 循环中的变量不会被记住。 Mysql bash脚本auto_increment