select c.pay_ability,
concat(round(sum(case when overdue_days is not NULL then 1 else 0 end)/count(*)*100,1),"%") overdue_ratio
from loan_tb l
join customer_tb c on c.customer_id=l.customer_id
group by c.pay_ability
order by overdue_ratio desc

按照还款能力级别统计有逾期行为客户占比。要求输出还款能力级别、逾期客户占比。

逾期占比=逾期数/总数,再进行字符串连接