求大神 mysql数据库用GROUP_CONCAT+group by查询出来的数据有重复累加的
SELECTg.goods_name,GROUP_CONCAT(o.total_integralSEPARATOR'+')total_integral,GROUP_CON...
SELECT g.goods_name, GROUP_CONCAT(o.total_integral SEPARATOR '+') total_integral, GROUP_CONCAT(i.count SEPARATOR '+') count, GROUP_CONCAT(i.integral SEPARATOR '+') integral, GROUP_CONCAT(o.trans_fee SEPARATOR '+') trans, GROUP_CONCAT(i.extra_price SEPARATOR '+') price, u.mobile, ad.trueName, aa.areaName, ad.addressFROM integralgoods_order oINNER JOIN igorder_gooditem i ON o.id=i.order_idINNER JOIN integral_goods g ON g.id = i.goods_idINNER JOIN `user` u ON u.id = o.user_idinner join address ad on ad.user_id=u.idinner join area aa on ad.area_id=aa.idWHERE i.addTime>="2019-07-01 00:00:00" and i.addTime<="2019-07-31 23:59:59" and i.goods_name="粉底液" and o.`status` != "0" and o.`status` != "-1"GROUP BY u.mobileORDER BY i.count desc如图查询出来的数据 6+6 4+4 是重复累加的 实际用户购买的只有一个6瓶粉底液的订单! 不知道哪里错误 求大神解救
展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询