Reputation: 605
I am not able to rectify the problem
UPDATE tbl_delete SET delete='60' WHERE tablename='somereports'
The above code throws error the following error:
Error in Updation Query
UPDATE tbl_delete SET delete='60' WHERE tablename='somereports'
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 'delete='60' WHERE tablename='somereports'' at line 1
Upvotes: 0
Views: 129
Reputation: 5131
DELETE
is a reserved keyword in MySQL so it's parsed like a keyword and not like a column name. MySQL expects valid DELETE
syntax after the DELETE
keyword but instead it "sees" an equals symbol (=). Wrap it in `` to fix the error like this:
UPDATE tbl_delete SET `delete`='60' WHERE tablename='somereports';
Upvotes: 3
Reputation: 22532
Delete is reserved keyword in mysql in must be in backtick
. OR change the column name which is not in the list of reserved keyword
UPDATE tbl_delete SET `delete`='60' WHERE tablename='somereports'
OR you can also write table name before column name as
UPDATE tbl_delete SET tbl_delete.delete='60' WHERE tbl_delete.tablename='somereports'
Upvotes: 3
Reputation: 44581
delete
is a reserved word in MySQL, you should use backticks to escape it:
UPDATE `tbl_delete` SET `delete`='60' WHERE `tablename`='somereports'
List of all MySQL reserved words
Upvotes: 6