select coalesce(product_id,'店铺汇总') product_id, concat(round(profit_rate,1),'%') profit_rate from ( select a.product_id, (1-sum(b.in_price*a.cnt)/sum(a.price*a.cnt))*100 profit_rate from tb_order_detail a inner join tb_product_info b on a.product_id = b.product_id and b.shop_id = 901 inner join tb_or...