clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
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. 1811935 fiddles created (25312 in the last week).

CREATE TABLE table1 ( `Item Name` VARCHAR(1), `Quantity` INTEGER ); INSERT INTO table1 (`Item Name`, `Quantity`) VALUES ('a', '10'), ('b', '15'), ('c', '2'); CREATE TABLE table2 ( `Item Name` VARCHAR(1), `Quantity` INTEGER ); INSERT INTO table2 (`Item Name`, `Quantity`) VALUES ('a', '45'), ('b', '2');
 hidden batch(es)


SELECT `Item Name`, SUM(Quantity) total_Quantity FROM ( SELECT `Item Name`, Quantity FROM table2 UNION ALL SELECT `Item Name`, -Quantity FROM table1 ) t GROUP BY `Item Name`
Item Name total_Quantity
a 35
b -13
c -2
 hidden batch(es)