SQL Statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have two SQL statements, one is giving me the total Quantity
available(from Stock table) and the other one is giving me the total number
of Quantity sold out.(from Sales Table). All these are GROUPED BY Item Name
e.g Handbags 3

Shoes 10
Is there a way of creating another SQL statement that will subtract the
Quantity sold from the total Quantity available so that I know the STOCK
REMAINING.
I need the syntax.
 
Give this a try.

SELECT StockTable.ItemName, Sum(STockTable.QtyAvailable),
Sum(SalesTable.QtySold)
FROM StockTable Join on StockTable.ItemName = SalesTable.ItemName
GROUP BY StockTable.ItemName
 
Back
Top