题解 | 商品销售排名
select
product_name,
cast(sum(price) as unsigned)
from
(
select
uid,
product_name,
ucl.product_id,
price
from
test.user_client_log ucl
join test.product_info pi on ucl.product_id = pi.product_id
where
pay_method != ''
group by
uid,
product_id,
price,
product_name
) a
group by
product_name
order by
sum(price) desc
查看9道真题和解析