'Mysql 8.0, On unique keys but got duplicated rows
I am using Mysql 8.0, and something strange happened.
I set the 'autoid' as primary key, and a group of keys as unique keys. SHOW CERATE TABLE below
I use the following code to insert new rows
SET UNIQUE_CHECKS=0;
INSERT INTO trading.Forex (ExecutionTime,TradeId,AllinRate,ValDate,Trader,Company
,Delivery,FixingDate,FxType,BaseCCY,BaseAmt,TermCCY,TermAmt
,SpotRate,TradeDate,CTPY) (SELECT * FROM trading.temp_test) ON DUPLICATE KEY UPDATE BaseCCY = VALUES(BaseCCY)
But I got two duplicated rows on unique keys:
Any idea about this issue? Thank you.
System environment: MySQL 8.0.19, win10
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|