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

时间:2011-04-17 07:56:21

标签: mysql

我有一个包含以下字段的mysql表:

id, desc, value, people, amount, weight

按照上面的顺序运行以下

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

follwoing是我得到的错误信息:

**#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

有人可以告诉我这是错的吗?

1 个答案:

答案 0 :(得分:1)

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

where `desc` = 'fat'