To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
SQL CourseSQL Course
> Ask questions about the lessons on SQL Course 1 and 2. If you have problems
> with the interface, please post in the Feedback forum
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.
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)