tps/database/reports/loan_balance.sql

12 lines
286 B
MySQL
Raw Normal View History

2023-03-24 21:43:28 -04:00
\timing
SELECT
r.*,
SUM(r."Advances"+r."Adjustments"-r."Payments") OVER (PARTITION BY "Loan#" ORDER BY r."Post Date" asc, r."Reference #" asc)
FROM
tpsv.pnco_default r
WHERE
"Loan#" = '606780191'
ORDER BY
r."Loan#"
,r."Post Date" ASC
,r."Reference #" ASC