Return a value from other table with condition

Hi Community,

I have a issue with me as I have 02 tables:

Discount Table:



Level



Sales Value



Discount



1



5000000



1,00%



2



10000000



2,00%



3



20000000



3,00%

Customer table:



Customer



Total Sales



Discount



Other



81350000







Mr. Tom



10037000







Mr. Minh



10400000







Mr. Lam



8440000







Ms. Ngoc



12350000







Ms. Thu



12850000





Now I want to take the discount from table Discount to column “Discount” in customer table, as per rule that if total sales < 5000000, discount is 0%, 5000000 - 10000000 discount 1%, 10000000 - 20000000 discount 2%, >20000000 discount 3%. I think I can use formula of Lookup and If, but my issue is I don’t want to put the value in formula, I want to validate with column in Discount table. Cause in future, if I want to change the value of discount, no need to revise the formula, just revise the data in discount table. Is someone have experience in this case and help me? Thanks for your review.

SELECT the MAX [discount] where [total sales] > [sales value]

1 Like

Thanks for your support