TYPE=VIEW
query=select `v`.`Acc_no` AS `sv_acc`,`lc`.`acc_no` AS `loan_acc`,round(if((`lc`.`poloan` = \'\'),(sum(`v`.`cr`) - sum(`v`.`dr`)),((sum(`v`.`cr`) - sum(`v`.`dr`)) / (select count(0) from `co-operativebank-210`.`loan_acc` where (`lc`.`acc_no` = `co-operativebank-210`.`loan_acc`.`acc_no`) group by `lc`.`acc_no`))),0) AS `bal`,`lc`.`sub_head` AS `sub_head`,(select count(0) from `co-operativebank-210`.`loan_acc` where (`lc`.`acc_no` = `co-operativebank-210`.`loan_acc`.`acc_no`) group by `lc`.`acc_no`) AS `total_p` from (`co-operativebank-210`.`voucher` `v` join `co-operativebank-210`.`loan_acc` `lc`) where ((`lc`.`loan_against_sv_acc` = `v`.`Acc_no`) and (`lc`.`sub_head` = \'23113\') and (`v`.`sub_head` = \'14201\') and (`v`.`date` <= \'2021-03-31\')) group by `lc`.`acc_no` order by `lc`.`date_open`
md5=6051f7306001b686013b93c1894fb84a
updatable=0
algorithm=0
definer_user=admin
definer_host=localhost
suid=1
with_check_option=0
timestamp=2023-03-09 06:11:30
create-version=1
source=select  `v`.`Acc_no`  AS  `sv_acc` ,\n `lc`.`acc_no`  AS  `loan_acc` ,\nround( if( (  `lc`.`poloan`  =  \'\' ), ( sum(  `v`.`cr`  )  - sum(  `v`.`dr`  )  ) , ( ( sum(  `v`.`cr`  )  - sum(  `v`.`dr`  )  )  / (  select count( 0  )  from  `co-operativebank-210`.`loan_acc`  where (  `lc`.`acc_no`  =  `co-operativebank-210`.`loan_acc`.`acc_no`  ) group  by  `lc`.`acc_no`  )  ) ),\n0 ) AS  `bal` ,\n `lc`.`sub_head`  AS  `sub_head` ,\n(  select count( 0  )  from  `co-operativebank-210`.`loan_acc`  where (  `lc`.`acc_no`  =  `co-operativebank-210`.`loan_acc`.`acc_no`  ) group  by  `lc`.`acc_no`  ) AS  `total_p`  from (  `co-operativebank-210`.`voucher`  `v`  join  `co-operativebank-210`.`loan_acc`  `lc`  ) where ( (  `lc`.`loan_against_sv_acc`  =  `v`.`Acc_no`  ) and (  `lc`.`sub_head`  =  \'23113\' ) and (  `v`.`sub_head`  =  \'14201\' ) and (  `v`.`date`  <=  \'2021-03-31\' ) ) group  by  `lc`.`acc_no`  order  by  `lc`.`date_open`
client_cs_name=utf8
connection_cl_name=utf8_general_ci
view_body_utf8=select `v`.`Acc_no` AS `sv_acc`,`lc`.`acc_no` AS `loan_acc`,round(if((`lc`.`poloan` = \'\'),(sum(`v`.`cr`) - sum(`v`.`dr`)),((sum(`v`.`cr`) - sum(`v`.`dr`)) / (select count(0) from `co-operativebank-210`.`loan_acc` where (`lc`.`acc_no` = `co-operativebank-210`.`loan_acc`.`acc_no`) group by `lc`.`acc_no`))),0) AS `bal`,`lc`.`sub_head` AS `sub_head`,(select count(0) from `co-operativebank-210`.`loan_acc` where (`lc`.`acc_no` = `co-operativebank-210`.`loan_acc`.`acc_no`) group by `lc`.`acc_no`) AS `total_p` from (`co-operativebank-210`.`voucher` `v` join `co-operativebank-210`.`loan_acc` `lc`) where ((`lc`.`loan_against_sv_acc` = `v`.`Acc_no`) and (`lc`.`sub_head` = \'23113\') and (`v`.`sub_head` = \'14201\') and (`v`.`date` <= \'2021-03-31\')) group by `lc`.`acc_no` order by `lc`.`date_open`
