tps/loan_bal.pgsql

13 lines
319 B
Plaintext
Raw Normal View History

2017-10-19 11:20:52 -04:00
SELECT
r.*,
SUM(r."Advances"+r."Adjustments"-r."Payments") OVER (ORDER BY r."Post Date" asc ,r."Reference #" asc)
FROM
tps.trans
LEFT JOIN LATERAL jsonb_populate_record(null::tps.pnco, rec) r ON TRUE
WHERE
rec @> '{"Loan#":"606780191"}'
ORDER BY
r."Post Date" asc
,r."Reference #" asc