-- 错误 SELECT SUM(price) FROM m_user -- 正确 SELECT TRUNCATE ( SUM( u.price ), 2 ) FROM m_user u;
-- 正确 SELECT SUM(TRUNCATE( u.price , 2 ) ) FROM m_user u;
-- 正确 但是和以上误差0.01 SELECT sum(cast(price as decimal(18,2))) FROM m_user
-- 错误 SELECT SUM(price) FROM m_user -- 正确 SELECT TRUNCATE ( SUM( u.price ), 2 ) FROM m_user u;
-- 正确 SELECT SUM(TRUNCATE( u.price , 2 ) ) FROM m_user u;
-- 正确 但是和以上误差0.01 SELECT sum(cast(price as decimal(18,2))) FROM m_user