![]() It is unlikely that the output you've shown is indeed an extract from the item table that you've defined: you are almost certainly looking at the content of some other table or query. However, these records also appear to violate the PRIMARY KEY constraint on id (i.e. | id | item_id | account_id | creation_date | modification_date | ![]() In your example above, the only records that appear to violate this constraint are: You have a compound index defined over the columns (item_id,account_id), so the constraint only requires that every record has a distinct combination of those two columns. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ciĭuplicate rows are being inserted into item similar to the following: id item_id account_id creation_date modification_dateĪ UNIQUE index creates a constraint such that all values in the index must be distinct. UNIQUE KEY `unique_item` (`item_id`,`account_id`) `modification_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `id` int(10) unsigned NOT NULL AUTO_INCREMENT, ![]() Would like to IGNORE insertion of duplicate rows based on two destination table columns defined as UNIQUE KEY, but for some reason, duplicate rows based on these two columns are still being inserted.ĭestination table definition: CREATE TABLE `item` ( Trying to populate an empty MySQL table by using INSERT INTO SELECT and joining two source tables. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |