Reputation: 3858
I am working on a custom eCommerce solution which requires a fairly complex pricing matrix to figure out prices. Currently orders are all made in person, so the client is using a massive excel spreadsheet to figure out prices.
Three factors dictate the price of a product:
Here are some example prices:
Currently there is no formulaic/systematic approach to how the numbers work, its just a massive spreadsheet. Does anyone have any pointers in how approach this problem from a database perspective?
Upvotes: 0
Views: 1227
Reputation: 2026
Assuming that your table covers all deliverable type/height/width/border combinations, try five columns (six if you want an id):
id long, // optional
ProductType varchar[16],
Height float,
Width float,
Border float,
Price float
And then find it with
SELECT Price
FROM tbl
WHERE ProductType = @t
AND Height = @h
AND Width = @w
AND Border = @b;
Upvotes: 2