题解 | 商品销售排名

商品销售排名

https://www.nowcoder.com/practice/79c6c3d6d66946f79387bca73c0a29f4

 -- 各商品销售数量
with
    t1 as (
        select
            product_id,
            sum(
                case
                    when step = 'select'
                    and pay_method is not null then 1
                    else 0
                end
            ) cnt
        from
            user_client_log
        group by
            product_id
    )
select
    product_name,
    cast(round(price * cnt, 0) as signed) total
from
    t1
    left join product_info p on t1.product_id = p.product_id
order by
    total desc
limit
    2

全部评论

相关推荐

神哥不得了:神哥来啦~1.建议不要包装,很容易问穿2.没日常也能找到暑期3.简历模板换一下,字体和版式看着好难受,而且最好压缩到一页,技术的倒数第2和3重复啦,项目建议换两个高质量的上去,如果时间够的话,八股就把高频top50的题目多巩固几遍,吃透,注意不要找假高频,这样绝对能找到暑期
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务