描述
查询6月份借款用户,在7.15的d1,d2的逾期率,分新老用户
- 用户借款时间为6.01-6.31
- 根据逾期天数分为d1和d2,d1表示逾期大于1天
- brrank确定新用户和老用户,新用户brrank=1,老用户brrank>1
- psperdno = 1 表示第一期借款
-- d1 新用户(brrank=1)d2(修改latedays > 1)
select
count(distinct custid) "总人数",
count(distinct case when latedays > 0 then custid end) "d1新用户逾期人数",
count(distinct case when latedays > 0 then custid end)*1.0/count(*) "d1新用户逾期率"
from
transformdata.xsfinrank
where brrank = 1 and psperdno = 1 and ('2018-06-30'::date - givemoneydate) >= 0 and (