MySQL Forums :: InnoDB :: INSERT AfTER LEFT JOIN creates duplicate records


Advanced Search

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
INSERT AfTER LEFT JOIN creates duplicate records 570 Brad Liu 09/19/2016 03:49PM
Re: INSERT AfTER LEFT JOIN creates duplicate records 306 Peter Brawley 09/20/2016 10:48AM
Re: INSERT AfTER LEFT JOIN creates duplicate records 313 Brad Liu 09/20/2016 01:00PM
Re: INSERT AfTER LEFT JOIN creates duplicate records 308 Peter Brawley 09/20/2016 02:08PM
Re: INSERT AfTER LEFT JOIN creates duplicate records 294 Brad Liu 09/21/2016 10:44AM
Re: INSERT AfTER LEFT JOIN creates duplicate records 287 Peter Brawley 09/21/2016 10:51AM
Re: INSERT AfTER LEFT JOIN creates duplicate records 262 Rick James 10/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.