SELECT tbl_ledger.id,SUM(amo) as credit,apdate,brid FROM tbl_traledger LEFT JOIN tbl_ledger ON tbl_ledger.id=(CONVERT(CONCAT(cty,cid) USING utf8) COLLATE utf8_general_ci) GROUP BY tbl_ledger.id;


SELECT tbl_ledger.id,SUM(amo) as debit,apdate,brid FROM tbl_traledger LEFT JOIN tbl_ledger ON tbl_ledger.id=(CONVERT(CONCAT(dty,did) USING utf8) COLLATE utf8_general_ci) GROUP BY tbl_ledger.id;



SELECT tbl_ledger.id,clsid,grid,sgrid,amo as credit,apdate,brid FROM tbl_traledger LEFT JOIN tbl_ledger ON tbl_ledger.id=(CONVERT(CONCAT(cty,cid) USING utf8) COLLATE utf8_general_ci) where clsid IN (4,5);


SELECT tbl_ledger.id,clsid,grid,sgrid,amo as debit,apdate,brid FROM tbl_traledger LEFT JOIN tbl_ledger ON tbl_ledger.id=(CONVERT(CONCAT(dty,did) USING utf8) COLLATE utf8_general_ci) where clsid IN (4,5);


SELECT tbl_ledger.id,clsid,grid,sgrid,ledger,debit,credit,tbl_ledgerdebitsum.apdate,tbl_ledgercreditsum.brid FROM `tbl_ledger` LEFT JOIN tbl_ledgerdebitsum ON tbl_ledger.id=tbl_ledgerdebitsum.id LEFT JOIN tbl_ledgercreditsum ON tbl_ledger.id=tbl_ledgercreditsum.id;