Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 213819

Calculate correct discount based on producer and daterange

$
0
0

Hello. I have two tables - one for Orders and one for discount.

 

Order:

OrderID, ProducerID, OrderDate, PurchasePrice

100,2,21.05.2016,1000

101,2,15.08.2016,1000

102,2,04.12.2016,1000

 

Discount:

ProducerID, ValidFromDate, Discount

2,01.05.2016,5   (valid from 01.05.2016-start of next date)

2,01.06.2016,6

2,01.07.2016,4

2,01.08.2016,7

 

I want to reduce the PurchasePrice by Discount based on the ProducerID AND Date comparision (is Orde.

 

How can I check the producer ID and correct date range to calculate the correct discount for the order?

 


Viewing all articles
Browse latest Browse all 213819

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>