clear markdown compare help donate or buy diddy dollings comments/suggestions/bugs a leap of faith? bible365
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 818513 fiddles created (9187 in the last week).

CREATE TABLE temp_table (asn INT, ean BIGINT, belegnr INT, quantity INT)
 hidden batch(es)


CREATE TABLE details LIKE temp_table
 hidden batch(es)


INSERT INTO temp_table VALUES (700000845, 4046228201122, 30059314, 2), (700000845, 4046228138879, 30059314, 3), (700000845, 4046228138875, 30059320, 25)
 hidden batch(es)


INSERT INTO details VALUES (700000845, 4046228201122, 30059314, 5), (700000845, 4046228138879, 30059314, 3), (700000845, 4046228138888, 30059320, 25)
 hidden batch(es)


SELECT * FROM temp_table
asn ean belegnr quantity
700000845 4046228201122 30059314 2
700000845 4046228138879 30059314 3
700000845 4046228138875 30059320 25
 hidden batch(es)


SELECT * FROM details
asn ean belegnr quantity
700000845 4046228201122 30059314 5
700000845 4046228138879 30059314 3
700000845 4046228138888 30059320 25
 hidden batch(es)


SELECT t1.asn, t1.ean, t2.ean oldean, t1.belegnr, t1.quantity, t2.quantity Oldqty FROM temp_table t1, details t2 WHERE t1.asn = t2.asn AND t1.belegnr = t2.belegnr AND ( t1.ean != t2.ean OR t1.quantity != t2.quantity )
asn ean oldean belegnr quantity Oldqty
700000845 4046228201122 4046228201122 30059314 2 5
700000845 4046228138879 4046228201122 30059314 3 5
700000845 4046228201122 4046228138879 30059314 2 3
700000845 4046228138875 4046228138888 30059320 25 25
 hidden batch(es)


SELECT t1.asn, t1.ean, t2.ean oldean, t1.belegnr, t1.quantity, t2.quantity Oldqty FROM temp_table t1, details t2 WHERE t1.asn = t2.asn AND t1.belegnr = t2.belegnr AND ( ( t1.ean = t2.ean AND t1.quantity != t2.quantity ) OR ( t1.ean != t2.ean AND t1.quantity = t2.quantity ))
asn ean oldean belegnr quantity Oldqty
700000845 4046228201122 4046228201122 30059314 2 5
700000845 4046228138875 4046228138888 30059320 25 25
 hidden batch(es)