题解 | 电商平台需要对商家的销售业绩、退款情况和客户满意度进行综合评估

电商平台需要对商家的销售业绩、退款情况和客户满意度进行综合评估

https://www.nowcoder.com/practice/48a236567617449eb6010274b30b29e8

select
    a.merchant_id,
    a.merchant_name,
    round(sum(sale_amount)/(count(distinct refund_id)*count(distinct satisfaction_id)),2) total_sales_amount, 
    round(sum(refund_amount)/(count(distinct sale_id)*count(distinct satisfaction_id)),2) total_refund_amount,
    round(avg(satisfaction_score),2) average_satisfaction_score
from
    merchants_underline a
    left join sales_underline b on a.merchant_id=b.merchant_id
    left join refunds_underline c on a.merchant_id=c.merchant_id
    left join satisfaction_underline d on a.merchant_id=d.merchant_id
group by
    1,
    2
order by 1

全部评论

相关推荐

评论
2
收藏
分享

创作者周榜

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