select
c.pay_ability,
concat(round(avg(if(l.overdue_days, 1, 0))*100, 1), '%') as overdue_ratio
from
customer_tb c
left join loan_tb l on c.customer_id = l.customer_id
group by pay_ability
order by overdue_ratio desc

select
c.pay_ability,
concat(round(avg(if(l.overdue_days, 1, 0))*100, 1), '%') as overdue_ratio
from
customer_tb c
left join loan_tb l on c.customer_id = l.customer_id
group by pay_ability
order by overdue_ratio desc