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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

SQL 3
Subtraction 2
Access Stock In Hand query in access 2007 0
Stock Control Database 1
Normalised Stock Table 8
Duplicate records in split database 5
Null in answer. 5
automatic deducting quantity from table 3

Back
Top