MySQL Update语法错误

时间:2010-03-04 22:02:10

标签: mysql sql-update

我需要像这样的MySQL查询:

UPDATE table_name
SET
    1 = 1
WHERE
    ID = 257

但是我得到了语法错误:

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 '1 = 1 
WHERE ID = 257' at line 3

需要执行UPDATE查询而不更新任何内容。 有什么解决方案?

2 个答案:

答案 0 :(得分:6)

UPDATE `table_name`
SET `ID` = `ID`
WHERE `ID` = 257

答案 1 :(得分:1)

怎么样:

UPDATE table_name
SET
    ID = 257
WHERE
    ID = 257

这会对你有用吗?