select r.ref_id,sum(r.ref_com),m.mname,p.bal_amt from member_commission as r inner join member_detail as m on r.ref_id=m.mem_id inner join member_payment as p on r.ref_id=p.mem_id where r.pay_check='unpaid' group by r.ref_id
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)