Answer the question
In order to leave comments, you need to log in
How to do multiplication in Select?
Who knows, help me fix the error, I don’t know how to do it, and whether it’s possible at all .. The bottom line is that I want to add the condition “if” currency = 0 (the site is not fresh, the essence is, if 0, then it is displayed in dollars, if 1 - rubles), then the payout amount will be multiplied by 73 (approximate dollar exchange rate), did so, everything is displayed, but the condition is not met
$db->Query("SELECT * FROM project WHERE project_status = 1 OR project_status = 2 AND (IF(valuta = 0,payments * 73,payments)) ORDER BY vip DESC, payments DESC");
Answer the question
In order to leave comments, you need to log in
SELECT CASE valuta WHEN 1 THEN price
WHEN 0 THEN price * 73
ELSE NULL
END AS price_in_rub,
...
FROM ...
WHERE ...
select *, price * (73 - (72 * valuta)) as price_in_rub
from ...
where ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question