I need a query that will get the total stock value (actual cost, and current retail).
Current retail is easy: = Qty in stock * current retail price.
Actual cost is more tricky, as it needs to ascertain how many in stock, then step back through invoices to work out actual cost paid for those items in stock - ie, last invoice may say £100 cost, previous invoice may say £90. So if there are 3 in stock, 2 were on last invoice, and 2 were on previous invoice, it needs to work out 2 x £100 + 1 x £90. If that makes sense?
Tables:
Products
ProductID - unique key
Description - description of product
RetailPrice - current retail price
CostPrice - current cost price (but not used in this query?)
StockLevel
StockLevelID - unique key
BranchID - link to branches (query needs to simply work for all branches added together)
UnitsInStock - integer for how many in stock at branchid
Invoices:
InvoiceID - unique key
ProductID - link to products
Quantity - integer for number of this item recieved
CostPrice - price for each item on this invoice
Does that make sense?