I am using MySQL and I have two tables:
master_table
- ORDERNO
- ITEM
- QTY
stock_bal
- ITEM
- BAL_QTY
Master table has duplicate ORDERNO and ITEM values. I have get total QTY using SQL 'GROUP BY' clause.
I need to deduct/subtract BAL_QTY from SUM of ITEM (master_table). I've got SUM QTY value using query (actually there are many rows).