I have the following sql statement below but however I want to increase the discount to 30 %, 40%, 50%, 60%, 70%, 80%, 90% instead of 20% if the price is over 1000.
if the price is over 1000, the the discount level is increased by 20%. So if the discount applied is 10%, then the 10% is itself increased 20%. So 20% of 10% is 2%, and the over 1000 price is therefore discounted at 12%.
if the price is above 440 less than 1000, apply the standard discount in the table.
if the price is 440 or below, no discount is applied.
SELECT ItemID, Title,
round( if(price >= 1000, price * (100 - ($price_discounts * 1.2))/100, if(price < 1000 and price > 440, price * (100 - $price_discounts) /100, price)) ,2) as SalePrice, price FROM alldata;
Aucun commentaire:
Enregistrer un commentaire