Forum Moderators: open
The query is
SELECT tblPrices.PropID, Min(IIf([tblPrices.PricePerPerson]=False,[tblPrices.PriceStandard]/[tblProperties.PropOccupancy],[tblPrices.PriceStandard])) AS MinPrice, tblProperties.ResortID, tblResorts.ResortName
FROM tblResorts INNER JOIN (tblProperties INNER JOIN tblPrices ON tblProperties.PropID = tblPrices.PropID) ON tblResorts.ResortID = tblProperties.ResortID
GROUP BY tblPrices.PropID, tblProperties.ResortID, tblResorts.ResortName;
TIA
Andrew
The problem I find using CASE is 1) Performance is bad 2) Stops you editing the queries visually.
You could also add tblProperties.PriceModel and get rid of PricePerPerson. Multiply PriceStandard X 1 When PriceModel=Standard. Something like this
SELECT Price * CASE When PriceModel=1 THEN 1 ELSE PropOccupancy END AS TotalPrice