194
194
case when tbl.debit is null and tbl.credit is null then 0 else tbl.debit-tbl.credit end as balance
197
SELECT aml.account_id, sum(COALESCE(aml.debit, 0.00)) as debit, sum(COALESCE(aml.credit, 0.00)) as credit
198
198
FROM account_move_line aml
200
200
GROUP BY aml.account_id) tbl on aa.id = tbl.account_id