SELECT IFNULL(product_id, '店铺汇总') as product_id, concat(ROUND(100 * (1 - SUM(in_price*cnt) / SUM(price*cnt)), 1),'%') as profit_rate FROM ( SELECT product_id, price, cnt, in_price FROM tb_order_detail JOIN tb_product_info USING(product_id) JOIN tb_order_ov...