我可以在MySQL INSERT查询上使用LIMIT 2吗? 例如在MySQL“INSERT”中使用“LIMIT”?
INSERT INTO MyTable
(user_name,password)
VALUES
(john,366543),
(sam,654654)
LIMIT 2
我试着和它说
`#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 'LIMIT 2' at line 1`
@pst感谢您的建议;我已经更新了答案,注意到这个...... – 2012-08-01 22:02:31
你会认为这很明显,对吧?如果您想限制您插入的数据量,请不要提供更多的值。 “INSERT INTO ... SELECT FROM”调用中的“LIMIT”与此处演示的相关。 – tadman 2012-08-01 22:15:40
LIMIT可以与UPDATE和DELETE一起使用。所以它不是SELECT的一部分。 – Andrew 2014-06-22 08:09:27