0

我有一个下表:

dct_cry_id............cry_id............dct_id............分类............dct_connection_id(.. .) 71.......................13............104276............ .....70..................0 2110........29....... ........104276............7............0 2111...... ............37............104276............8...... ......0 2112............38............104276...... ............6............0(......)591............ ....13........154614..................540........0 2090.. .....................36........154614..................46。 ......................0 2091......................30............ 154614.......................2................0 (...)

我使用以下查询

I use following query
INSERT INTO mytabletest1 (cry_id,`dct_id`)
-- VALUES (222)
SELECT  
222, `dct_id`

FROM `mytabletest1`
WHERE `cry_id`
NOT IN 
(
112, 115, 116, 117, 118,
973, 974, 975, 976, 977,
8 
)

不幸的是,我有以下警告/错误消息:

“!#1062 - 键‘cry_id’的重复条目‘222-104276’”

为什么我有这个消息?

在此之后,我检查了我的表,我的查询有效 :dct_cry_id............cry_id............dct_id............classify ........dct_connection_id (...) 71.......................13.......... ..104276........70........0 2110...... ......29............104276............7 0 2111............37............104276............ ..8......................0 2112............38....... .....104276............6............0 153876............ ............222............104276............0...... .0 (...) 591......................13............154614...... .........540.............0 2090........36.. ............154614............46............0 2091............ ......................30............154614............2....... ...........0 15870......................222............154614............0 .............0 (...)

4

1 回答 1

0

您的查询将返回键 '222-104276' 4 次。记录插入一次,第二次插入时引发错误。

于 2013-09-12T15:58:20.943 回答