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


Advanced Search

INSERT AfTER LEFT JOIN creates duplicate records
Posted by: Brad Liu ()
Date: September 19, 2016 03:49PM

Below is the stored procedure running at work hours every day. The purpose is to add new and update records from SBT to so_detail.

INSERT INTO so_detail
(so_num, cust_num, part_num, descrip, disc, cost, price, qtyord, qtyshp, extprice, ord_date, req_date, dealer_type, part_cls, location, sostat, discls, wh_id)
SELECT s.sono, s.custno, s.item, s.descrip, s.disc, s.cost, s.price, s.qtyord, s.qtyshp, s.extprice, CONCAT(s.ordate, ' ', time(now())), CONCAT(s.rqdate, ' ', time(now())),
s.terr, s.class, s.seq, s.sostat, s.disclass, whID
FROM SBT.SOTRAN s
LEFT JOIN so_detail d ON s.sono = d.so_num AND s.item = d.part_num
WHERE d.so_num IS NULL;

Almost every one month, there is duplicated record (exactly the same for two lines of records ) in so_detail created.
Has no clue where these duplicates come from.
There is no place to insert screenshot? :)

Thank You!
Brad

Options: ReplyQuote


Subject Views Written By Posted
INSERT AfTER LEFT JOIN creates duplicate records 614 Brad Liu 09/19/2016 03:49PM
Re: INSERT AfTER LEFT JOIN creates duplicate records 328 Peter Brawley 09/20/2016 10:48AM
Re: INSERT AfTER LEFT JOIN creates duplicate records 333 Brad Liu 09/20/2016 01:00PM
Re: INSERT AfTER LEFT JOIN creates duplicate records 325 Peter Brawley 09/20/2016 02:08PM
Re: INSERT AfTER LEFT JOIN creates duplicate records 310 Brad Liu 09/21/2016 10:44AM
Re: INSERT AfTER LEFT JOIN creates duplicate records 299 Peter Brawley 09/21/2016 10:51AM
Re: INSERT AfTER LEFT JOIN creates duplicate records 274 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.