Home > database >  About limit parameter error
About limit parameter error

Time:03-29

When using the update statement

The UPDATE table SET var=15 LIMIT 10; This statement can be through,

But the following statement prompt syntax errors, I do not know what reason be

The UPDATE table SET var=15 LIMIT 10, 10;

Error message is as follows:
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 at line 1
'10'
If you use the: SELECT * FROM table LIMIT 10, 10; Wouldn't a syntax error

The barrel of the teacher can help take a look at what is

CodePudding user response:

Checked the online solution is to adopt the way of the subquery

The UPDATE table SET var=15 WHERE the var in (SELECT var FROM (SELECT * FROM table LIMIT 20, 10) AS t);

Behind is very trouble, don't know why to want to add the AS, without error
  • Related