vault backup: 2024-08-29 13:47:15

This commit is contained in:
Paul Trowbridge 2024-08-29 13:47:15 -04:00
parent 88b0760e6d
commit 44fcdf2ca5

View File

@ -1,17 +1,17 @@
with with
dcard AS ( dcard AS (
SELECT SELECT
'dcard' srce 'dcard' srce
,r.id ,r.id id
,r.logid ,r.logid logid
--,r."Trans. Date" --,r."Trans. Date"
,r."Post Date" ,r."Post Date" pdate
,r."Description" ,r."Description" descr
,r."Amount" ,-r."Amount" amount
,r."Category" ,r."Category" category
,r."Party" ,r."Party" party
,r."Reason" ,r."Reason" reason
,SUM(r."Amount") OVER (ORDER BY r."Post Date" asc , r."Description") + 1083.50 balance ,-(SUM(r."Amount") OVER (ORDER BY r."Post Date" asc , r."Description") + 1083.50) balance
FROM FROM
tpsv.dcard_mapped r tpsv.dcard_mapped r
ORDER BY ORDER BY
@ -44,21 +44,36 @@ dcard AS (
--,r."Trans Date" --,r."Trans Date"
,r."Post Date" ,r."Post Date"
,r."Description" ,r."Description"
,-r."Amount" "Amount" ,r."Amount" "Amount"
,r."Type" ,r."Type"
,null::text "Party" ,null::text "Party"
,null::text "Reason" ,null::text "Reason"
,SUM(-r."Amount") OVER (ORDER BY r."Post Date" asc , r.id) + 374.23 balance ,-(SUM(-r."Amount") OVER (ORDER BY r."Post Date" asc , r.id) + 374.23) balance
FROM FROM
tpsv.chase_default r tpsv.chase_default r
ORDER BY ORDER BY
r."Post Date" desc r."Post Date" desc
) )
,stacked AS ( ,stacked AS (
SELECT * FROM dcard SELECT * FROM dcard
UNION ALL UNION ALL
SELECT * FROM hunt SELECT * FROM hunt
UNION ALL UNION ALL
SELECT * FROM chase SELECT * FROM chase
) )
select * from stacked order by "Post Date" desc SELECT
s.srce
,s.id
,s.logid
,s.pdate
,s.descr
,s.amount
,s.category
,s.party
,s.reason
,s.balance
,sum(s.amount) over (ORDER BY s.pdate asc, s.id) + 28452.02 netbalance
FROM
stacked s
ORDER BY
s.pdate desc