Querry:
ID
Date
CustomerID
ProductID
Size
.............
Table:
CustomerID
ProductID
Size
StartDate
EndDate
Discount
SQL
SELECT Querry.ID, Querry.Date, Querry.CustomerID, Querry.ProductID, Querry.Size, Table.Discount,......
FROM Querry LEFT JOIN Table ON (Querry.ProductID = Table.ProductID) AND (Querry.CustomerID = Table.CustomerID) AND (Querry.Size = Table.Size) AND (Querry.Date >= Table.StartDate) AND (Querry.Date <= Table.EndDate);
Specific Customer will get a discount in Price for Specific Product and Size, for Specicific period, there can be
ID
Date
CustomerID
ProductID
Size
.............
Table:
CustomerID
ProductID
Size
StartDate
EndDate
Discount
SQL
SELECT Querry.ID, Querry.Date, Querry.CustomerID, Querry.ProductID, Querry.Size, Table.Discount,......
FROM Querry LEFT JOIN Table ON (Querry.ProductID = Table.ProductID) AND (Querry.CustomerID = Table.CustomerID) AND (Querry.Size = Table.Size) AND (Querry.Date >= Table.StartDate) AND (Querry.Date <= Table.EndDate);
Specific Customer will get a discount in Price for Specific Product and Size, for Specicific period, there can be