/*注意:脏数据包括空值和空字符串,二者概念不同,虽然题目未要求处理空值,但还是加上会严谨一些,空字符串要用单引号,聚合函数和group by 优先用group by,因为窗口函数可能会有重复计算,group by 直接去重了,更加简洁明了。
初--步--框--架
联表:
from user_client_log u
join product_info p on u.product_id = p.product_id
计数;count(*) over(partition by pay_method) as cnt
排序:order by cnt desc
筛选:where pay_method != "'" and pay_method is not null
*/
select 
case 
    when pay_method = '' or pay_method is null then "error" 
    else pay_method 
    end
as pay_method
,count(step) as cnt
from user_client_log u
join product_info p on u.product_id = p.product_id
where product_name = "anta"
and step = "select"
group by case 
    when pay_method = '' or pay_method is null then "error" 
    else pay_method 
    end
order by cnt desc