日期:2014-05-16 浏览次数:20836 次
mysql> select 1.234,round(1.234,2); +-------+----------------+ | 1.234 | round(1.234,2) | +-------+----------------+ | 1.234 | 1.23 | +-------+----------------+ 1 row in set (0.06 sec) mysql>
------解决方案--------------------
mysql> select currentPrice from t_lonelyriver; +--------------+ | currentPrice | +--------------+ | 1.23456 | | 1.26776 | | 1.26432 | +--------------+ 3 rows in set (0.00 sec) mysql> select avg(currentPrice),round(avg(currentPrice),2) -> from t_lonelyriver; +-------------------+----------------------------+ | avg(currentPrice) | round(avg(currentPrice),2) | +-------------------+----------------------------+ | 1.25554666666667 | 1.26 | +-------------------+----------------------------+ 1 row in set (0.05 sec) mysql>