query to return minimal product of two fields

G

Guest

To return a minimal price of a bottle of vodka stored in field "price" I
can call MIN function .

However this price ignores the size of the bottle.
Bottle types and sizes are stored in a different table called "Bottles"

Suppose I wanted to get a product with the minimal price per litre.
Obviously I have to multiply the bottle price by the bottle size.

Can I do it in one query which will fetch the minimal per/liter price?
 
G

Guest

Thanks,
I have been given a tip to do like this:

SELECT Min([PriceTable].[Price] / [Bottles].[SizeInLiters])
FROM [PriceTable] INNER JOIN [Bottles]
ON [PriceTable].[BottleID] = [Bottles].[BottleID];
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top