mirror of
https://github.com/acedanger/budget-database.git
synced 2025-12-05 22:50:13 -08:00
added support for multiple accounts in the budget detail table
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user