MySQL Forums
Forum List  »  InnoDB

Re: INSERT AfTER LEFT JOIN creates duplicate records
Posted by: Rick James
Date: October 03, 2016 11:18PM

* What was the value of autocommit? Was this in a BEGIN...COMMIT? Show us some details.
* `SOTRAN` really should have a PRIMARY KEY.
* Was Replication involved?
* `part_num` and `item` are declared the same. Fix that. (No, I can't see how that would cause the problem.)
* Could the two inserts have come from different connections? Or the same connection?
* Shouldn't (so_num, part_num) be UNIQUE? Better yet, make it the PRIMARY KEY? And, since you do not have such a composite INDEX, the query is much more inefficient than it should be.
* Making that pair UNIQUE (or PRIMARY) would let you use `INSERT IGNORE`, thereby avoiding the clumsy SELECT+LEFT JOIN.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: INSERT AfTER LEFT JOIN creates duplicate records
891
October 03, 2016 11:18PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.