MySQL round half

后端 未结 4 1066
时光取名叫无心
时光取名叫无心 2021-01-23 14:27

Is it possible, in MySQL, to round half a specific way like PHP would do?

  • PHP_ROUND_HALF_UP
  • PHP_ROUND_HALF_DOWN
  • P
4条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-23 14:50

    If you get an error applying @Jonathan's function saying:

    Error 1418: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) SQL Statement:...
    

    You should put DETERMINISTIC or other applicable declaration before BEGIN

    DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled

提交回复
热议问题