sql语句:
(SELECT SUM(o_g.goods_amount) AS
amount_sum,SUM(o_g.goods_cost*o_g.goods_number) AS
cost_sum,SUM(o_g.goods_number) AS number_sum
FROM erp_order_goods AS o_g
LEFT OUTER JOIN erp_order AS o ON o_g.order_id = o.order_id
LEFT OUTER JOIN erp_goods AS g ON g.gid = o_g.goods_id
LEFT OUTER JOIN erp_brand AS b ON b.brand_id = g.brand_id WHERE
(o.add_time BETWEEN “1389715200” AND “1389772885”) AND (o.order_status=1 OR
o.order_status=2)) UNION ALL
(SELECT SUM(o_a_g.goods_change_amount) AS
amount_sum,SUM(o_a_g.goods_cost*o_a_g.goods_change_number) AS
cost_sum,SUM(o_a_g.goods_change_number) AS number_sum
FROM erp_order_after_goods AS o_a_g
LEFT OUTER JOIN erp_order_after AS o_a ON o_a_g.order_after_id = o_a.order_after_id
LEFT OUTER JOIN erp_goods AS g ON g.gid = o_a_g.goods_id
LEFT OUTER JOIN erp_brand AS b ON b.brand_id = g.brand_id WHERE
(o_a.add_time BETWEEN “1389715200” AND “1389772885”))
解决方案:
将o_a_g.goods_change_amount的字段类型从float(10,2)修改为decimal(10,2)
原创文章,作者:kepupublish,如若转载,请注明出处:https://blog.ytso.com/175129.html