我有一张桌子:
dct_cry_id ............ cry_id ............ dct_id ..........分类........ dct_connection_id (......) 71 ........................ 13 ............ 104276 ........... ... 70 .............. 0 2110 ...................... 29 ............ 104276 ............. 0.7 ............... 0 2111 ...................... 37 ............ 104276 ............. 0.8 ............... 0 2112 ...................... 38 ............ 104276 ............. 0.6 ............... 0 (......) 591 ....................... 13 ............ 154614 ............ ..540 ............. 0 2090 ...................... 36 ............ 154614 ............. 0.46 .............. 0 2091 ...................... 30 ............ 154614 ............. 0.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 ..........分类........ dct_connection_id (......) 71 ........................ 13 ............ 104276 ........... ... 70 .............. 0 2110 ...................... 29 ............ 104276 ............. 0.7 ............... 0 2111 ...................... 37 ............ 104276 ............. 0.8 ............... 0 2112 ...................... 38 ............ 104276 ............. 0.6 ............... 0 的 153876 .................... 222 ........... 104276 ............. 0.0 ............... 0 (......) 591 ....................... 13 ............ 154614 ............ ..540 ............. 0 2090 ...................... 36 ............ 154614 ............. 0.46 .............. 0 2091 ...................... 30 ............ 154614 ............. 0.2 ............... 0 的 15870 ..................... 222 ........... 154614 ............ ..0 ............... 0 (...)
答案 0 :(得分:0)
您的查询将返回密钥'222-104276'4次。记录被插入一次,第二次插入时出现错误。