Been working too much, can't figure this out. I have a part table that has info on parts. I need to combine this with 3 other tables that have various discounts.
Each part can have a discount for a Region, Tier or Customer, or all three. There are multiple Regions, Tiers, and Customers. I'm wanting to generate a price sheet that takes a product's cost and subtracts relevant discounts (if there are any) based on the customer and calculates margins.
There is an effective date because I need some historical data.
Here's the relevant info:
Part Table:
PartID
Cost
RegionDiscount Table:
RegionID
PartID
Discount
Effective Date
TierDiscount Table:
TierID
PartID
Discount
Effective Date
CustomerDiscount Table:
CustomerID
PartID
Discount
Effective Date
What I am trying to do is combine these into a query which has the following:
PartID
Cost
Region Discount - If there is an applicable effective date
Tier Discount - If there is an applicable effective date
Customer Discount - If there is an applicable effective date
Final Price = Cost - (Sum of Discounts)
Note that it is possible for a part to have no discounts, so those must show up as well. Any ideas?
Each part can have a discount for a Region, Tier or Customer, or all three. There are multiple Regions, Tiers, and Customers. I'm wanting to generate a price sheet that takes a product's cost and subtracts relevant discounts (if there are any) based on the customer and calculates margins.
There is an effective date because I need some historical data.
Here's the relevant info:
Part Table:
PartID
Cost
RegionDiscount Table:
RegionID
PartID
Discount
Effective Date
TierDiscount Table:
TierID
PartID
Discount
Effective Date
CustomerDiscount Table:
CustomerID
PartID
Discount
Effective Date
What I am trying to do is combine these into a query which has the following:
PartID
Cost
Region Discount - If there is an applicable effective date
Tier Discount - If there is an applicable effective date
Customer Discount - If there is an applicable effective date
Final Price = Cost - (Sum of Discounts)
Note that it is possible for a part to have no discounts, so those must show up as well. Any ideas?