call sqmdb_cost.kpi_31('202203');

--create schema sqmdb_cost

SELECT concat('select ''',tablename,''' as table_name,count(1) as sum from ',tablename,' union all') FROM pg_tables where schemaname = 'sqmdb_cost'

SELECT to_char('2022-06-01'::timestamp, 'D');

SELECT extract(DOW FROM '2022-06-01'::timestamp);

select date_trunc('day',now()) + '-2 DAY',now() - INTERVAL '2 DAY'

--truncate table o2p.cfg_0_5g_siteinfo 

select sdate,count(*) from sqmdb_cost.kuandai_ftth kf group by sdate order by sdate desc 

select substring(tablename,length(tablename)-1,2),* from pg_tables where schemaname='sqmdb_cost'



