# 3.20 11:42 —— # 字段:折扣率 (GMV / 吊牌金额) with tb1 as( select item_id, sales_price, tag_price*sales_num as avg_price,tag_price from sales_tb left join product_tb using(item_id) ) select round(round(sum(sales_price)/sum(avg_price),4)*100,2) from tb1 # 此处用了总GMV / 总标价