题解 | 商品销售排名

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

全部评论

相关推荐

karis_aqa:和hr没关系,都是打工的
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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