#还资金方流水明细--1
SELECT DISTINCT flow_id from test_linfang.funding_repayment_record t1
join audit.loan_manifest t2 on t1.loan_id=t2.loan_id and t2.is_active = 1
and t1.is_active = 1 and t2.loan_paid_at >= '2016-12-01' and t2.loan_paid_at < '2017-01-01'
and t1.repaid_at < '2017-07-01' and t1.lkb2fund_id IS not NULL ;
#还资金方流水明细--2
SELECT t1.loan_id,t2.name '资金方',t3.loan_paid_at '放款时间',t1.term_no '期数',date(t1.repaid_at) '实还时间',t1.current_repayment '实还总额',
t1.principle '实还本金',t1.interest '实还利息',t1.flow_id
FROM test_linfang.funding_repayment_record t1
JOIN new_transaction.funding_corp t2 on t1.funding_code = t2.id
JOIN all_back_0630.loan_manifest t3 on t1.loan_id = t3.loan_id AND t3.is_active = 1 AND t1.is_active = 1
                                       AND t1.flow_id in ();