add running discover card balance
This commit is contained in:
parent
a630f46833
commit
6b8d14ddb7
13
dcard_bal.pgsql
Normal file
13
dcard_bal.pgsql
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
\timing
|
||||||
|
SELECT
|
||||||
|
r.*,
|
||||||
|
rec->'id',
|
||||||
|
SUM(r."Amount") OVER (PARTITION BY srce ORDER BY r."Post Date" asc , rec->>'id' asc, r."Description") + 1061.1 + 22.40
|
||||||
|
FROM
|
||||||
|
tps.trans
|
||||||
|
LEFT JOIN LATERAL jsonb_populate_record(null::tps.dcard, rec) r ON TRUE
|
||||||
|
WHERE
|
||||||
|
srce = 'DCARD'
|
||||||
|
ORDER BY
|
||||||
|
r."Post Date" asc
|
||||||
|
,rEC->>'id' asc
|
Loading…
Reference in New Issue
Block a user