El_Pablo Posted January 20, 2009 Posted January 20, 2009 Hi, How would you model the structure of the tables to know what was the price of a product in time? In a billing system it's important to keep the price up to date and also keep the price paid for a product for a specific time. This is one of my approach products (pkProductID, price (lookup from prices), ...) prices (pkPriceID, fkProductIDprice, date, ...) billDetail (fkProductID, fkBillID, price (lookup from product), ...) Thanx for any other suggestion.
comment Posted January 20, 2009 Posted January 20, 2009 The price in Products is redundant. The line item (billDetail) can lookup directly from Prices, based on ProductID and either the date or just the most recent price (depending on whether you have future prices and/or bill retroactively).
El_Pablo Posted January 20, 2009 Author Posted January 20, 2009 To get the most recent price, I will need to create a script? I'm I right or there's another way?
comment Posted January 20, 2009 Posted January 20, 2009 No, not at all - just sort the relationship by date (or by PriceID), descending.
Recommended Posts
This topic is 5845 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now