题解 | #某宝店铺折扣率#
某宝店铺折扣率
https://www.nowcoder.com/practice/3a56f160308441f5a79d8ac8d953e5e7
# 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 / 总标价
