Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- br.branch_name,
- SUM ( b.cash_amount ) as cash_amount,
- SUM ( b.bank_amount ) as bank_amount,
- SUM ( b.bon_amount ) as bon_amount,
- COALESCE ( b.cash_amount, 0 ) + COALESCE ( b.bank_amount, 0 ) + COALESCE ( b.bon_amount, 0 ) AS total_amount
- FROM
- balance b
- JOIN branch br ON br.ID = b.branch_id
- JOIN account_statement stmt ON b.branch_id = stmt.branch_id
- WHERE
- stmt.transaction_date >= '2021-08-04'
- GROUP BY
- br.branch_name,
- b.cash_amount,
- b.bank_amount,
- b.bon_amount;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement