开发者

mysql duplicate record field

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜