I am working on a database project for my final project prior to graduation. I am trying to figure out how to write a query that will show what the current parts quantity is on hand after orders are entered. Below is my diagram of the tables that I have created and their relationships.
I am thinking that the ProductID x ProductOrderQty would be used. Then data pulled from the PartsRequired table for the corresponding ProductID and multiply the Parts by the ProductOrderQty. Then that number would be subtracted from the PartQtyInStock in the Part Table.
I think I can figure out how to write that. The problem is how to I save that information so the next time we run the inventory query it pulls the last inventory data rather than going through all of the orders and doing the calculations.
I appreciate any advice...
It won't let me attach my diagram...so...
Part Table
PK-PartID
PartName
Description
FK-VendorID
PartQtyInStock
OrderInfoTable
PK-OrderID
FK-ClientID
FK-ProductID
OrderDate
ProductOrderQty
ProductPrice
PartsRequired
PK-FK-PartID
FK-ProductID
QtyRequired