with
t1 as(
select
merchant_id,
merchant_name,
round(sum(sale_amount)/2,2) as total_sales_amount,
round(sum(refund_amount)/4,2) as total_refund_amount,
round(avg(satisfaction_score),2) as average_satisfaction_score
from
merchants_underline
left join sales_underline using(merchant_id)
left join refunds_underline using(merchant_id)
left join satisfaction_underline using(merchant_id)
group by
merchant_id,
merchant_name
)
select * from t1

京公网安备 11010502036488号