0

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

3 Answers 3

6

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

Sign up to request clarification or add additional context in comments.

Comments

3

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' 

Comments

3

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'; 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.