Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Effective date of prices
Message
 
To
06/01/1999 08:32:04
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00173090
Message ID:
00173114
Views:
33
Hi Jason,

>What I need to do, preferably in a query or set of queries, is to find the invoice value of all invoices between a certain period. This means that I must determine the correct value of each product when it was sold.

I'm no expert on SQL, so there's probably a better solution out there, but the following SELECT should give you the price of an item:

Invoices - inv no, inv date, part no, quantity, etc...
Price list - part no, price, effective date
Select Top 1 price, effective_date ;
   From PriceList ;
   Where part_no = invoices.part_no ;
     and effective_date <= invoices.inv_date ;
   Order by effective_date Desc
Without Top 1 it is the first record that contains the correct price.

Christof
--
Christof
Previous
Reply
Map
View

Click here to load this message in the networking platform