added support for multiple accounts

This commit is contained in:
Peter Wood
2023-03-04 21:10:46 -05:00
parent e88dffe457
commit 098ea60ef0
5 changed files with 71 additions and 61 deletions

View File

@@ -1,18 +1,21 @@
drop view public.runbal;
drop view if exists public.runbal;
create view public.runbal
as
select
trxdate
, trxdescription
, trxamount
, to_char(trxdate, 'day') day_of_week
, sum(trxamount) over(
acct.bank_name
, acct.account_type
, acct.account_number
, acct.friendly_name
, det.trx_date
, det.trx_description
, det.trx_amount::numeric(8,2)
, to_char(det.trx_date, 'day') day_of_week
, sum(det.trx_amount) over(
order by
trxdate
, trxamount desc rows unbounded preceding
) runningbal
det.trx_date
, det.trx_amount desc rows unbounded preceding
) running_bal
from
public.budgetdetails
public.budgetdetails det
join public.accounts acct using (acct_id)