Good day!
I am looking for the solution.
I have a table like TABLE_1 with sales contract parameters:
Client Min_Quantity Price
John 1 20 Eiro
John 2 10 Eiro
John 5 5 Eiro
Sara 1 15 Eiro
Sara 3 10 Eiro
And I have TABLE_2 with exact sales data:
Client Sold
John 1
Sara 4
I need to compare these two table in order to calculate correct price based on the following logic:
IF John bought at least 5 Kg, his price would be 5 Eiro,
Then IF John bought at least 2 Kg, his price would be 10 Eiro,
Then IF John bought at least 1 Kg, his price would be 20 Eiro,
else ... (can make Null() value right now, but in fact have to be 20 Eiro)
According to this logic, the result have to be like in Table_3:
Client Correct Price
John 20 Eiro
Sara 10 Eiro
I need to understan, how to calculate Table 3