[Err] 1062 - Duplicate entry 'obj_daa08e286b884b13a358c9497eaeefbb' for key 'PRIMARY'
时间: 2023-11-06 22:59:18 浏览: 83
1062 - Duplicate entry 'obj_daa08e286b884b13a358c9497eaeefbb' for key 'PRIMARY'是一个MySQL错误,意味着出现了主键冲突,即在插入数据时,数据表中已经存在相同的主键值。
为了解决这个问题,可以尝试以下两种方法:
方法1: 使用NotIn过滤掉主键冲突。可以使用以下SQL语句:
INSERT INTO dbbackup.tb1 SELECT * FROM tb1 WHERE (key1, key2) NOT IN (SELECT key1, key2 FROM dbbackup.tb1);
这条语句的作用是将tb1表中不存在于dbbackup.tb1表中的数据插入到dbbackup.tb1表中,以避免主键冲突。 1062 - Duplicate entry 'obj_daa08e286b884b13a358c9497eaeefbb' for key 'PRIMARY'的问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [【数据库-MySql】[Err] 1062 - Duplicate entry '1-1' for key 'PRIMARY'](https://blog.csdn.net/chenlu5201314/article/details/100521863)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]
阅读全文