Results 1 to 2 of 2

Thread: How to get last price of product?

  1. #1
    Join Date
    Mar 2009
    Posts
    1

    How to get last price of product?

    HI,

    I've classic Order table and order_details table.
    How can retrieve last price of each product?

    The result can be like this:
    ProductCode | LastPrice
    ------------ | ---------
    Cod1 | 10.25
    Cod2 | 23.56
    Cod3 | 12.23
    ...
    ....

    Is possible get this result via ONE storedprocedure?

    thanks,
    sfvaleriano

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    What do you have in product details table, is price is that table too?

    It is a two step process, can be done in a subquery.

    First get last sell date (max(date)) from order detaills table by grouping product details on productid, join the result with product details to get the sell price, with join on date.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •