I don't know how to word the title properly, anyway what I mean is: For example I have this 'transaction' table
SELECT ITEM_ID, SUM(QUANTITY) AS IN
WHERE TYPE = IN
GROUP BY ITEM_ID
-
SELECT ITEM_ID, SUM(QUANTITY) AS OUT
WHERE TYPE = OUT
GROUP BY ITEM_ID
How do I combine those 2 statements so I can do operation on them? Thanks Basically what I want is something like this
SELECT ITEM_ID,
SUM(QUANTITY) where Type = In "Item In",
SUM(Quantity) where Type = Out "Item Out",
Item In - Item Out "Final Qty"
GROUP BY ITEM_ID
