added support for multiple accounts in the budget detail table

This commit is contained in:
Peter Wood
2023-03-06 11:58:49 -05:00
parent f07d5a4c7c
commit 1214176dba
3 changed files with 42 additions and 15 deletions

View File

@@ -3,19 +3,21 @@ drop view if exists public.runbal;
create view public.runbal
as
select
acct.bank_name
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
det.trx_date
, det.trx_amount desc rows unbounded preceding
) running_bal
, trx.trx_date
, trx.trx_description
, trx.trx_amount::numeric(8,2)
, to_char(trx.trx_date, 'day') day_of_week
, sum(trx.trx_amount)
over(
partition by trx.acct_id
order by
trx.trx_date
, trx.trx_amount desc rows unbounded preceding
) running_bal
from
public.budgetdetails det
public.budgetdetails trx
join public.accounts acct using (acct_id)