Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/59.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过左键连接选择mysql插入重复条目错误_Mysql_Wpml - Fatal编程技术网

通过左键连接选择mysql插入重复条目错误

通过左键连接选择mysql插入重复条目错误,mysql,wpml,Mysql,Wpml,你好,我正在用wpml复制wordpress中的自定义帖子 所以我有两张桌子: 1:wp_icl_翻译 2:wp_员额 wp_icl_翻译有行: translation_id(primary), element_type , element_id, trid, language_code, source_language_code wp_posts有很多行,但我只得到: ID(primary) 我的问题是: Insert into `wp_icl_translations` (`elemen

你好,我正在用wpml复制wordpress中的自定义帖子 所以我有两张桌子:

1:wp_icl_翻译 2:wp_员额

wp_icl_翻译有行:

translation_id(primary), element_type , element_id, trid, language_code, source_language_code
wp_posts有很多行,但我只得到:

ID(primary)
我的问题是:

Insert into `wp_icl_translations` (`element_type`,`element_id`,`trid`,`language_code`,`source_language_code` )
Select "post_timeline",`wp_posts`.`ID`,`wp_icl_translations`.`trid`,`wp_icl_translations`.`language_code`,`wp_icl_translations`.`source_language_code`
FROM `wp_icl_translations`
LEFT JOIN `wp_posts`
ON `wp_posts`.`oldid`=`wp_icl_translations`.`element_id`
WHERE `wp_icl_translations`.`element_type` = "post_news"
我收到错误#1062-键“trid#u lang”的重复条目“0-”
有人能帮我找出我做错了什么吗?

您没有插入主键(翻译id)。在列转换上尝试
AUTO_INCREMENT
\u id translation\u id已经是一个AUTO_INCREMENTOk,然后您有一个名为trid\u lang的唯一索引,并为该索引插入一个重复值谢谢@sh88以获取响应。我将尝试查找此索引。您不需要插入主键(翻译id)。在列转换上尝试
AUTO_INCREMENT
\u id translation\u id已经是一个AUTO_INCREMENTOk,然后您有一个名为trid\u lang的唯一索引,并为该索引插入一个重复值谢谢@sh88以获取响应。我将尝试查找此索引。