select ifnull(inf.product_id,"店铺汇总") productid , concat(round((1-sum(in_price*cnt)/sum(price*cnt))*100,1),"%") profit_rate from tb_product_info inf inner join tb_order_detail det on inf.product_id = det.product_id inner join tb_order_overall ove on det.order_id = ove.order_id where shop_id = 901 and date(event_time)>="2021-10-01" group by inf.product_id with rollup having profit_rate>24.9 or productid is null order by productid 求问感觉逻辑一样的 为什么店铺汇总还是在最后一行呀
1

相关推荐

牛客网
牛客网在线编程
牛客网题解
牛客企业服务