Hi,
I am new to SQL and I am currently facing a problem when I attempt to minus the two result of two queries which i listed below:
I USED THIS STATEMENT:
"SELECT master.itemcode, inward.quantity AS totalinward, outward.quantity AS totaloutward FROM master INNER JOIN "
+ "(SELECT itemcode, SUM(quantity) AS quantity FROM inward AS totalinward group by itemcode) AS inward ON master.itemcode = inward.itemcode INNER JOIN "
+ "(SELECT itemcode,SUM(quantity) AS quantity FROM outward AS totaloutward group by itemcode)AS outward ON master.itemcode = outward.itemcode";
I am getting the result like this:
ItemCode totalinward totaloutward closingstock
CBC000010 1000 500
i need the result (totalinward - totaloutward = closing stock)
ItemCode totalinward totaloutward closingstock
CBC000010 1000 500 500
Does anyone know how to solve this problem? Thanks