Thread: Product table
View Single Post
  #4  
Old April 21st, 2010, 06:46 PM posted to microsoft.public.access.gettingstarted
KenSheridan via AccessMonster.com
external usenet poster
 
Posts: 1,610
Default Product table

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