Template : new_ready_disburse_html_block
Frontend URL : https://loantap.in/banking
with q0 as ( #get all active loans who have account 'Ready to Disburse' in loan entries select active_loans.* from active_loans join loan_entries on active_loans.sublan_id=loan_entries.sublan_id where loan_entries.account='Ready to Disburse' ), q1 as ( #remove loan records those are disbursed Select q0.*,loan_entries.account from q0 left join loan_entries on q0.sublan_id=loan_entries.sublan_id and loan_entries.account='Loan Disbursed' where account is null ), q2 as ( #Count Loans group by NBFC select count(1) as ready_to_disburse_count, nbfc from q1 group by nbfc ) #join with common_meta to get nbfc Name select sub_sanction.*,meta_value as nbfc_label from q2 as sub_sanction join common_meta on sub_sanction.nbfc=common_meta.object_id and coll_id='nbfc' and meta_key='nbfc_name'
Get all active loans who have account ‘Ready to Disburse’ in loan entries
Remove loan records those are disbursed
Count sublans group by NBFC
join with common_meta to get nbfc Name