My query:
SELECT CASE WHEN a.merchant = 'apple' THEN ( a.price / 0.9 ) * 0.8 ELSE a.price END AS 'price', a.*, b.* FROM products a JOIN data b on ( a.post_id = b.post_id ) AND a.price BETWEEN 0 AND 4 ORDER BY a.score DESC LIMIT 0, 11
My querstion is, how to change the query so that the new discounted price (after CASE function) is compared in (BETWEEN) function.
Currently BETWEEN function compare old price.