Results 1 to 3 of 3

Thread: Easy select ????

  1. #1
    Join Date
    Jan 2003
    Posts
    3

    Post Easy select ????

    I' have problems doing a query into our product register.

    I have two tables

    VVARPF contains ProductInformation
    VVVARE = ProductNumber
    VVTEK = ProductDescription

    VVPRPF contains PriceChanges
    VPVARE = ProductNumber
    VPDATE = ChangedDate
    VPPRICE = ProductPrice

    I need to lookup the price on the product at the current time. The VVPRPF register can contain prospective pricechanges used for future campaigns etc. That means I can't select the largest date.

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    It assumes the price which last changed before current date is the right price.


    select product.VVVARE, price.VPPRICE
    from VVARPF product, VVPRPF price
    where product.ProductNumber = price.ProductNumber
    and price.VPDATE =
    (select max(VPDATE)
    from VVPRPF
    where VPDATE < getdate()
    and VVPRPF.VVVARE = product.VVVARE)

  3. #3
    Join Date
    Jan 2003
    Posts
    3

    Cool Thanks, it works !!!!!!

    Thanks, it works !!!!!!

Posting Permissions

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