我无法解决问题
UPDATE tbl_delete SET delete='60' WHERE tablename='somereports'
以上代码抛出以下错误:
更新查询错误
更新tbl_delete SET delete ='60'WHER tablename ='somereports'
您的SQL语法有错误;查看与MySQL服务器版本对应的手册,以便在第1行'delete ='60'WHERE tablename ='somereports''附近使用正确的语法
答案 0 :(得分:6)
delete
是MySQL中的保留字,你应该使用反引号来逃避它:
UPDATE `tbl_delete` SET `delete`='60' WHERE `tablename`='somereports'
答案 1 :(得分:3)
mysql中的删除是reserved keyword必须在backtick
中。或者更改不在保留关键字列表
UPDATE tbl_delete SET `delete`='60' WHERE tablename='somereports'
或者您也可以在列名之前将表名写为
UPDATE tbl_delete SET tbl_delete.delete='60' WHERE tbl_delete.tablename='somereports'
答案 2 :(得分:3)
DELETE
是MySQL中的保留关键字,因此它像关键字一样被解析,而不像列名。 MySQL期望在DELETE
关键字之后使用有效的DELETE
语法,而不是"看到"等于符号(=)。把它包裹在``来修复这样的错误:
UPDATE tbl_delete SET `delete`='60' WHERE tablename='somereports';