0
在下面的查詢中,如果表a中的價格等於999999,那麼SELECT語句具有IF情況,如果將n_price設置爲0,則價格保持不變。在WHERE子句中使用SELECT IF
我想知道的是在WHERE子句中使用n_price(來自查詢的更新值)而不是a.price
來執行計算嗎?如果不是將檢索值的簡單方式在WHERE子句
SELECT
IF(a.price = 999999, 0, a.price) AS n_price,
l.quantity AS n_quantity,
l.condition AS n_condition
FROM b_products b
LEFT JOIN a_products a ON b.id = a.id
LEFT JOIN l_products l ON b.id = l.id
WHERE
AND ROUND((a.price/100*80) - l.price) >= (l.price/100*30)