题解 | 商品销售总额分布

商品销售总额分布

https://www.nowcoder.com/practice/62909494cecd4eab8c2501167e825566

select
    (
        case
            when pay_method = '' then 'error'
            else pay_method
        end
    ) as pay_method,
    count(*) as cnt
from
    user_client_log u
    left join product_info p on u.product_id = p.product_id
where
    product_name = 'anta'
    and step = 'select'
group by
    pay_method
order by
    cnt desc

  1. 只有select步骤的数据有pay_method字段: where step = 'select'
  2. 如果select中pay_method为''则以error标记pay_method为脏数据: case when pay_method = '' then 'error' else pay_method end

全部评论

相关推荐

zhiyog:哈哈哈哈哈哈哈哈哈哈哈哈哈
点赞 评论 收藏
分享
流浪的神仙:无恶意,算法一般好像都得9硕才能干算法太卷啦
点赞 评论 收藏
分享
05-19 15:21
已编辑
华南农业大学 Java
白火同学:你才沟通了200,说实话,北上广深杭这里面你连一座城市的互联网公司都没投满呢,更别说还有各种准一线二线城市了。等你沟通突破了三位数,还没结果再考虑转行的事吧。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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