query to return minimal product of two fields

Discussion in 'ASP General' started by Guest, Dec 27, 2003.

  1. Guest

    Guest 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?
     
    Guest, Dec 27, 2003
    #1
    1. Advertising

  2. Guest

    dlbjr Guest

    Yes,

    Showing the exact field names in each table would help write the SQL.

    --
    -dlbjr

    Discerning resolutions for the alms
     
    dlbjr, Dec 27, 2003
    #2
    1. Advertising

  3. Guest

    Guest 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];


    "dlbjr" <> wrote in message
    news:...
    > Yes,
    >
    > Showing the exact field names in each table would help write the SQL.
    >
    > --
    > -dlbjr
    >
    > Discerning resolutions for the alms
    >
    >
     
    Guest, Dec 30, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QVZM?=

    product studio query

    =?Utf-8?B?QVZM?=, May 15, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    407
    =?Utf-8?B?QVZM?=
    May 15, 2007
  2. padma
    Replies:
    0
    Views:
    353
    padma
    Oct 3, 2007
  3. Jon F.

    CAML Query: Multiple Query Fields Issue

    Jon F., May 12, 2004, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    758
    Jon F.
    May 12, 2004
  4. Replies:
    4
    Views:
    323
    Phrogz
    Nov 2, 2007
  5. AMT2K5
    Replies:
    1
    Views:
    199
    Eric Schwartz
    Nov 8, 2005
Loading...

Share This Page