题解 | 商品销售总额分布
商品销售总额分布
https://www.nowcoder.com/practice/62909494cecd4eab8c2501167e825566
select pay_method_new, count(1) as cnt
from (
select product_id, pay_method,
case when (pay_method is null or pay_method='') then 'error' else pay_method end as pay_method_new
from user_client_log
where step='select'
) a join product_info b on a.product_id=b.product_id
where product_name='anta'
group by pay_method_new
order by cnt desc
题目中用空字符串'',is null 无法捕获,需要用 pay_method=''
查看18道真题和解析