mysql sum函数后面好多位小数点解决方式

SELECT consignee, goods_name, SUM(goods_loading_quantity) FROM electronic_circuit where \n" +
" goods_name in (SELECT name FROM precursor_chemicals) and destination LIKE ‘%金山区%’ and consignee not in(SELECT name from consignee_business)\n" +
“and DATE_FORMAT(end_time,’%Y%m’) =’”+yearMonth+"‘and goods_name=’"+s+"’" +
"GROUP BY consignee
SUM(goods_loading_quantity)写成
cast(sum(goods_loading_quantity) AS decimal(15,2))即可

你可能感兴趣的:(数据库)