sql server - SQL Select Statement with If Else -
i have following sql statement below want increase discount 30 %, 40%, 50%, 60%, 70%, 80%, 90% instead of 20% if price on 1000.
if price on 1000, the discount level increased 20%. if discount applied 10%, 10% increased 20%. 20% of 10% 2%, , on 1000 price therefore discounted @ 12%.
if price above 440 less 1000, apply standard discount in table.
if price 440 or below, no discount applied.
select itemid, title, round( if(price >= 1000, price * (100 - ($price_discounts * 1.2))/100, if(price < 1000 , price > 440, price * (100 - $price_discounts) /100, price)) ,2) saleprice, price alldata;
Comments
Post a Comment