TYPE=VIEW
query=select max(`v`.`date`) AS `date`,`v`.`Acc_no` AS `acc_no`,if(((sum(`v`.`cr`) - sum(`v`.`dr`)) > 0),\'Active\',\'Close\') AS `Status` from `co-operativebank-230`.`voucher` `v` where (((`v`.`head` = \'14100\') or (`v`.`head` = \'14200\') or (`v`.`head` = \'14300\')) and (`v`.`date` <= \'2025-07-09\') and ((`v`.`cr` > 0) or (`v`.`dr` > 0))) group by `v`.`Acc_no` union all select max(`v`.`date`) AS `date`,`v`.`Acc_no` AS `acc_no`,if(((sum(`v`.`dr`) - sum(`v`.`cr`)) > 0),\'Active\',\'Close\') AS `Status` from `co-operativebank-230`.`voucher` `v` where (((`v`.`head` = \'23300\') or (`v`.`head` = \'23400\') or (`v`.`head` = \'23100\') or (`v`.`head` = \'23200\')) and (`v`.`date` <= \'2025-07-09\') and ((`v`.`cr` > 0) or (`v`.`dr` > 0))) group by `v`.`Acc_no` union all select max(`v`.`date`) AS `date`,`v`.`Acc_no` AS `acc_no`,if(((sum(`v`.`cr`) - sum(`v`.`dr`)) > 0),\'Active\',\'Close\') AS `Status` from `co-operativebank-230`.`voucher` `v` where (((`v`.`head` = \'11100\') or (`v`.`head` = \'11200\')) and (`v`.`date` <= \'2025-07-09\') and ((`v`.`cr` > 0) or (`v`.`dr` > 0))) group by `v`.`Acc_no`
md5=f29b768f12d360e8583691dc886526ed
updatable=0
algorithm=0
definer_user=admin
definer_host=%
suid=2
with_check_option=0
timestamp=2025-07-09 10:43:01
create-version=1
source=select max(v.date) as date,v.acc_no,if(sum(cr)-sum(dr)>0,\'Active\',\'Close\') as Status from voucher v where  (head=\'14100\' or head=\'14200\' or head=\'14300\')  and date<=\'2025-07-09\' and (cr>0 or dr>0)  group by v.acc_no union all select max(v.date) as date,v.acc_no,if(sum(dr)-sum(cr)>0,\'Active\',\'Close\') as Status from voucher v where  (head=\'23300\' or head=\'23400\' or head=\'23100\' or head=\'23200\')  and date<=\'2025-07-09\' and (cr>0 or dr>0)  group by v.acc_no union all select max(v.date) as date,v.acc_no,if(sum(cr)-sum(dr)>0,\'Active\',\'Close\') as Status from voucher v where  (head=\'11100\' or head=\'11200\')  and date<=\'2025-07-09\' and (cr>0 or dr>0) group by v.acc_no
client_cs_name=utf8
connection_cl_name=utf8_general_ci
view_body_utf8=select max(`v`.`date`) AS `date`,`v`.`Acc_no` AS `acc_no`,if(((sum(`v`.`cr`) - sum(`v`.`dr`)) > 0),\'Active\',\'Close\') AS `Status` from `co-operativebank-230`.`voucher` `v` where (((`v`.`head` = \'14100\') or (`v`.`head` = \'14200\') or (`v`.`head` = \'14300\')) and (`v`.`date` <= \'2025-07-09\') and ((`v`.`cr` > 0) or (`v`.`dr` > 0))) group by `v`.`Acc_no` union all select max(`v`.`date`) AS `date`,`v`.`Acc_no` AS `acc_no`,if(((sum(`v`.`dr`) - sum(`v`.`cr`)) > 0),\'Active\',\'Close\') AS `Status` from `co-operativebank-230`.`voucher` `v` where (((`v`.`head` = \'23300\') or (`v`.`head` = \'23400\') or (`v`.`head` = \'23100\') or (`v`.`head` = \'23200\')) and (`v`.`date` <= \'2025-07-09\') and ((`v`.`cr` > 0) or (`v`.`dr` > 0))) group by `v`.`Acc_no` union all select max(`v`.`date`) AS `date`,`v`.`Acc_no` AS `acc_no`,if(((sum(`v`.`cr`) - sum(`v`.`dr`)) > 0),\'Active\',\'Close\') AS `Status` from `co-operativebank-230`.`voucher` `v` where (((`v`.`head` = \'11100\') or (`v`.`head` = \'11200\')) and (`v`.`date` <= \'2025-07-09\') and ((`v`.`cr` > 0) or (`v`.`dr` > 0))) group by `v`.`Acc_no`
