SQL Statement

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.
 
L

Lynn Trapp

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
 
D

David Seeto via AccessMonster.com

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
Stock Control Database 1
Access Stock In Hand query in access 2007 0
Duplicate records in split database 5
Normalised Stock Table 8
Dsum Issues 0
Null in answer. 5

Top