题解 | 分析客户逾期情况

select
    a.pay_ability,
    concat (round((sum(判断) / count(*)) * 100, 1), '%') overdue_ratio
from
    (
        select
            case
                when overdue_days is not null then 1
                when overdue_days is null then 0
            end 判断,
            lt.customer_id,
            customer_age,
            pay_ability,
            overdue_days
        from
            test.customer_tb ct
            join test.loan_tb lt on ct.customer_id = lt.customer_id
    ) a
group by
    a.pay_ability
order by
    overdue_ratio desc

全部评论

相关推荐

牛客38347925...:9,2学生暑期实习失利开始投小厂,给这群人整自信了
点赞 评论 收藏
分享
代码飞升:别用口语,后端就写后端,前端就写前端,最后别光后悔
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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