I have three tables joined by a left join. Here is the code:
SELECT (LEAST(`a`.`price, `b`.`price`) - `c`.`price`) AS `diff` ... ORDER BY `diff` DESC
Problem: c . price greater than LEAST, so the subtraction is negative and throws the BIGINT UNSIGNED value out of range. How can I make NOT throw this ridiculous mistake?
This is the result data, I do not change the actual data in the table, so why does this not allow me to do this normally? I tried CAST(LEAST(...) AS SIGNED) and discarded both columns inside LEAST as signed, did not work.
source share