moving to postgres

This commit is contained in:
Peter Wood
2023-03-04 18:23:05 -05:00
parent 477bfe3cfb
commit 9348a36809
20 changed files with 126 additions and 0 deletions

46
postgres/temp.sql Normal file
View File

@@ -0,0 +1,46 @@
/*
truncate table budgetdetails;
CALL public.import_budget_from_csv();
CALL public.update_budget_from_import();
*/
select
lower(trxdescription) trxdescription
, avg(abs(trxamount)) avg_amt
, min(abs(trxamount)) min_amt
, max(abs(trxamount)) max_amt
, count(trxdescription) rec_cnt
from
public.budgetdetails b
where
trxdate <= current_date
and abs(trxamount) > 0
group by
lower(trxdescription)
having
count(1) > 2
order by
rec_cnt desc
, trxdescription;
select
bal.trxdate
, bal.day_of_week
, age(trxdate, current_date) as days_from_today
, bal.trxdescription
, bal.trxamount
, bal.runningbal
from
public.runbal bal
where
trxdate between current_date and (
current_date + interval '2 weeks'
)::date
;
select * from budgetimport b
where dt like '2023-03%'