In the attached db, the query ITEMDETAIL is the current price for all Items based on Quantity. It uses this query to get the latest/most recent price based on Max(EFFDATE)
SELECT d.UPC, d.QUANTITY AS LQTY, t.LDATE, d.PRICE AS PPU, d.VAT AS LVAT
FROM Prices AS d INNER JOIN (SELECT UPC, QUANTITY...