Is there a way to overwrite or skip duplicate records?
1062 - Duplicate entry '2' for key 1
is there a way to add : insert on duplicate key update to开发者_开发技巧 a sql file that only has insert?
Have a look at 12.2.5.1. INSERT ... SELECT Syntax and 12.2.5. INSERT Syntax
And look for
Specify IGNORE to ignore rows that would cause duplicate-key violations.
try this:
INSERT ON DUPLICATE KEY UPDATE
Although usually people forget to put the autoincrement field for the id and thus the error.
精彩评论