Is it possible, in MySQL, to round half a specific way like PHP would do?
PHP_ROUND_HALF_UP
PHP_ROUND_HALF_DOWN
P
Rounding on half specifically can be done using the ROUND
function in just a single line:
SELECT ROUND(ROUND({your_input_value}*2,0)/2,1);
ROUND({your_input_value}*2,0)
gives you a rounded value as a whole integer.Similar other rounds with round up, down, or other multipliers like 3,4, etc can be created.