Compare commits
2 Commits
c56f59045a
...
88b0760e6d
Author | SHA1 | Date | |
---|---|---|---|
88b0760e6d | |||
eb63f3ce72 |
@ -1,8 +1,8 @@
|
|||||||
\timing
|
\timing
|
||||||
SELECT
|
SELECT
|
||||||
r.*
|
r.*
|
||||||
,SUM(r."Amount") OVER (ORDER BY r."Post Date" asc , r."Description") + 1061.1 + 22.40 balance
|
,SUM(r."Amount") OVER (ORDER BY r."Post Date" asc , r."Description") + 1083.50 balance
|
||||||
FROM
|
FROM
|
||||||
tpsv.dcard_default r
|
tpsv.dcard_mapped r
|
||||||
ORDER BY
|
ORDER BY
|
||||||
r."Post Date" desc
|
r."Post Date" desc
|
||||||
|
@ -3,6 +3,6 @@ SELECT
|
|||||||
r.*
|
r.*
|
||||||
,SUM(r."Amount") OVER (ORDER BY r."Date" asc , r.id) + 29909.75 balance
|
,SUM(r."Amount") OVER (ORDER BY r."Date" asc , r.id) + 29909.75 balance
|
||||||
FROM
|
FROM
|
||||||
tpsv.hunt_default r
|
tpsv.hunt_mapped r
|
||||||
ORDER BY
|
ORDER BY
|
||||||
r."Date" desc
|
r."Date" desc
|
||||||
|
64
database/reports/stacked.sql
Normal file
64
database/reports/stacked.sql
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
with
|
||||||
|
dcard AS (
|
||||||
|
SELECT
|
||||||
|
'dcard' srce
|
||||||
|
,r.id
|
||||||
|
,r.logid
|
||||||
|
--,r."Trans. Date"
|
||||||
|
,r."Post Date"
|
||||||
|
,r."Description"
|
||||||
|
,r."Amount"
|
||||||
|
,r."Category"
|
||||||
|
,r."Party"
|
||||||
|
,r."Reason"
|
||||||
|
,SUM(r."Amount") OVER (ORDER BY r."Post Date" asc , r."Description") + 1083.50 balance
|
||||||
|
FROM
|
||||||
|
tpsv.dcard_mapped r
|
||||||
|
ORDER BY
|
||||||
|
r."Post Date" desc
|
||||||
|
)
|
||||||
|
,hunt as (
|
||||||
|
SELECT
|
||||||
|
'hunt' srce
|
||||||
|
,r.id
|
||||||
|
,r.logid
|
||||||
|
--,r."Reference Number"
|
||||||
|
--,r."Payee Name"
|
||||||
|
,r."Date"
|
||||||
|
,r."Memo"
|
||||||
|
,r."Amount"
|
||||||
|
,r."Cateogry Name"
|
||||||
|
,r."Party"
|
||||||
|
,r."Reason"
|
||||||
|
,SUM(r."Amount") OVER (ORDER BY r."Date" asc , r.id) + 29909.75 balance
|
||||||
|
FROM
|
||||||
|
tpsv.hunt_mapped r
|
||||||
|
ORDER BY
|
||||||
|
r."Date" desc
|
||||||
|
)
|
||||||
|
,chase AS (
|
||||||
|
SELECT
|
||||||
|
'chase' srce
|
||||||
|
,r.id
|
||||||
|
,r.logid
|
||||||
|
--,r."Trans Date"
|
||||||
|
,r."Post Date"
|
||||||
|
,r."Description"
|
||||||
|
,-r."Amount" "Amount"
|
||||||
|
,r."Type"
|
||||||
|
,null::text "Party"
|
||||||
|
,null::text "Reason"
|
||||||
|
,SUM(-r."Amount") OVER (ORDER BY r."Post Date" asc , r.id) + 374.23 balance
|
||||||
|
FROM
|
||||||
|
tpsv.chase_default r
|
||||||
|
ORDER BY
|
||||||
|
r."Post Date" desc
|
||||||
|
)
|
||||||
|
,stacked AS (
|
||||||
|
SELECT * FROM dcard
|
||||||
|
UNION ALL
|
||||||
|
SELECT * FROM hunt
|
||||||
|
UNION ALL
|
||||||
|
SELECT * FROM chase
|
||||||
|
)
|
||||||
|
select * from stacked order by "Post Date" desc
|
Loading…
Reference in New Issue
Block a user