Advertisement
killtdj

Query Laporan Saldo

Aug 24th, 2021 (edited)
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2.     br.branch_name,
  3.     SUM ( b.cash_amount ) as cash_amount,
  4.     SUM ( b.bank_amount ) as bank_amount,
  5.     SUM ( b.bon_amount ) as bon_amount,
  6.     COALESCE ( b.cash_amount, 0 ) + COALESCE ( b.bank_amount, 0 ) + COALESCE ( b.bon_amount, 0 ) AS total_amount
  7. FROM
  8.     balance b
  9.     JOIN branch br ON br.ID = b.branch_id
  10.     JOIN account_statement stmt ON b.branch_id = stmt.branch_id
  11. WHERE
  12.     stmt.transaction_date >= '2021-08-04'
  13. GROUP BY
  14.     br.branch_name,
  15.     b.cash_amount,
  16.     b.bank_amount,
  17.     b.bon_amount;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement