【发布时间】:2014-01-17 11:48:21
【问题描述】:
在我的网页上没有插入或更新,但我已经收到此错误:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0-Bekoo-2449.10' for key 'group_key'
这很令人惊讶,因为网页没有修改任何行,并且Product 表没有group_key 列或键。
我的查询:
SELECT Product._like,
comment_count,
title,
price_lower,
price,image,
AffiliateOffers.name,
payout_yuzde,
payout_nakit,
payout_type,
xml_id,
brand,model,
currency,url,
Product.aff_id,
Product.offer_id,
pb_share_1,
pb_share_2,
pb_share_1_payda,
pb_share_2_payda,
AffiliateOffers.seo_title,
afo_offer_id,
r_category,
seo_description
FROM Product
inner Join AffiliateOffers on Product.aff_id = AffiliateOffers.af_id
AND Product.offer_id = AffiliateOffers.af_offer_id
where Product.status = 1
and Product.aff_id = 1
and Product.offer_id = 1290
还有我的表结构:
` CREATE TABLE `_product` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`xml_id` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`aff_id` int(11) NOT NULL,
`offer_id` int(11) NOT NULL,
`r_category` int(11) NOT NULL,
`category_id` int(11) NOT NULL,
`category_id1` int(11) NOT NULL,
`category_id2` int(11) NOT NULL,
`category_id3` int(11) NOT NULL,
`brand` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`model` varchar(75) COLLATE utf8_unicode_ci DEFAULT NULL,
`title` mediumtext COLLATE utf8_unicode_ci NOT NULL,
`description_1` mediumtext COLLATE utf8_unicode_ci,
`price` decimal(18,2) NOT NULL,
`price_lower` decimal(18,2) NOT NULL,
`percentage_lower` int(11) NOT NULL,
`image` mediumtext COLLATE utf8_unicode_ci NOT NULL,
`url` text COLLATE utf8_unicode_ci,
`feature` tinyint(4) NOT NULL,
`city` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
`sex` tinyint(4) NOT NULL,
`stock` tinyint(4) NOT NULL,
`start_date` int(25) NOT NULL,
`finish_date` int(25) NOT NULL,
`update_date` int(25) NOT NULL,
`status` tinyint(4) NOT NULL DEFAULT '1',
`hit` int(11) NOT NULL DEFAULT '1',
`_like` int(11) NOT NULL DEFAULT '0',
`comment_count` int(11) DEFAULT NULL,
`like_count` int(11) DEFAULT NULL,
`lastlike_time` int(25) DEFAULT NULL,
`visit_count` int(11) DEFAULT NULL,
`lastvisit_count` int(25) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `xml_id` (`xml_id`),
KEY `lastlike_time` (`lastlike_time`),
KEY `offer_id` (`offer_id`),
KEY `r_category` (`r_category`),
KEY `status` (`status`)
) ENGINE=MyISAM AUTO_INCREMENT=3816867 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci`
为什么会出现这个错误?
【问题讨论】:
-
我添加了一个编辑。没有“group_key”键。
-
(主键或唯一索引)具有 3 个唯一字段。某处必须有写操作。也许是触发器?
-
在我的桌子上只有一个键和它的主要 (ID) 。不,没有写操作,也没有触发
-
刚刚发布:你的表结构(完整的
SHOW CREATE TABLE)和你的查询
标签: mysql