in reply to Date Ranges Question
Update: and the code for changing the price updates the entry with an end-date of 31st Dec 9999 (the existing current price record), to an end-date equal to the cessation date inserts a new record with the new price, a start date of the commencement date and the same 31/12/9999 end date as before. The cessation date is the day before the new commencement date unless the datetime is meant to be intraday.SELECT xxx_price FROM price_history WHERE product_id = <query-product-id> AND <query-date> BETWEEN start_date AND end_date
The logical primary key will include the product id, start date and end date, although in practice an artificial primary key of e.g. entry_id may be used for performance purposes.
-M
Free your mind
|
|---|