Thanks Andrew.
Code:
Item_Id Valid_From Valid_To Price
======= ========== ---------- -----
12345 2005-01-01 2005-06-30 500.00
12345 2005-07-01 0000-00-00 600.00
Lets say the price of my product (item_id 12345) was updated from $500 to $600 starting from 2005-07-01 as indicated in your example above.
I plan to leave the valid_to column of the new price null or 0000-00-00 as I will not know the exact date of a future increase on the price of this product...is that a bad idea?
Basically a client's booking details will have a field called "prices_confirmed_until" in order to work out what price the client has to pay for their products.
To give an example. Lets say the client booked me back in January of 2004 to do their job on 2005-02-01. I guarantee the prices until 8 weeks after this date and then prices revert to current prices. So that means their "prices_confirmed_until" field will have a value of 2005-03-29.
Code:
Item_Id Valid_From Valid_To Price
======= ========== ---------- -----
12345 2005-01-01 2005-06-30 500.00
12345 2005-07-01 2005-10-31 600.00
12345 2005-11-01 0000-00-00 700.00
Looking at the scenario where a client submits their order on 2005-11-15, well past the "prices_confirmed_until" date. The plan is to check this date against the "prices_confirmed_until" field. In this case it will say current prices apply, as we only guaranteed them until 2005-03-29 (8 weeks after job date). Then it needs to find the correct price to charge. I'm guessing that I should get the program to find the null valid_to date and ensure the valid_from date is prior to the date their order was submitted.
Am I going about this arse about? Something tells me there is probably a more elegant solution to processing this data.
Thanks.
Brad