tps/reload/pncl/extract.sql
Paul Trowbridge 9d5a69c891 load pncl
2018-05-30 11:10:23 -04:00

30 lines
629 B
SQL

--transactions with date in download format for constraint
--transactions with date in download format for constraint
COPY
(
SELECT
r."Schedule#"
,to_char(r."PostDate",'mm/dd/yyyy') "Post Date"
,r."Assn#"
,r."Coll#"
,r."AdvanceRate"
,r."Sales"
,r."Credits & Adjustments"
,r."Gross Collections"
,r."CollateralBalance"
,r."MaxEligible"
,r."Ineligible Amount"
,r."Reserve Amount"
FROM
tps.trans
JOIN LATERAL jsonb_populate_record(NULL::tps.pncl, rec) r ON TRUE
WHERE
srce = 'PNCL'
)
TO 'C:\users\ptrowbridge\downloads\pncl.csv' WITH (format csv, header TRUE)
--source
SELECT DEFN FROM TPS.SRCE WHERE SRCE = 'PNCL'