Come to think of it the first query, to compute the stock in hand per batch,
doesn't need to sum the quantity per batch as this is a single value per
batch, so:
SELECT Product, ManufactureDate,
Batches.Quantity - SUM(SaleDetails.Quantity) AS StockInHand
FROM Products, Batches, SaleDetails
WHERE Batches.ProductID = Products.ProductID
AND SaleDetails.ProductID = Batches.ProductID
AND SaleDetails.ManufactureDate = Batches.ManufactureDate
GROUP BY Product, ManufactureDate, Batches.Quantity;
Ken Sheridan
Stafford, England
--
Message posted via
http://www.accessmonster.com