题解 | 商品销售总额分布

商品销售总额分布

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

#anta
# every pay methode number distribution desc
with t1 as
(select ul.*,pi.price,pi.product_name, case when ul.pay_method='' and ul.step='select' then 'error' else  ul.pay_method end as method_with_dirty
from user_client_log ul left join product_info pi on ul.product_id=pi.product_id
where pi.product_name="anta")


select t1.method_with_dirty,count(*) as number
from t1
group by t1.method_with_dirty
having t1.method_with_dirty!=""
order by number desc

本题两个注意事项:

1.有两种脏数据需要处理 1.题目明确指出的 “”且 ul.step = select的脏数据,此类脏数据才会标为error,计入结果

2.其余脏数据照样得剔除。

全部评论

相关推荐

积木_积木:这 tm 不纯纯大作业吗
点赞 评论 收藏
分享
牛客96763241...:杭电✌️也是打完招呼,没人回吗
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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