123456789101112131415161718192021222324252627282930 |
- --23、铁塔共享率 select * from sqmdb_cost.tower2
- ---地市
- with t as (select distinct sdate,city_operator,area_operator,site_addr_id,is_duxiang from sqmdb_cost.tower3 where stype in ('新建及共享改造','存量注入'))
- select
- sdate,
- city_operator,
- sum(case when is_duxiang='共享' then 1 else 0 end) as share_num,
- count(*) as total_num,
- sum(case when is_duxiang='共享' then 1 else 0 end)/count(*)::numeric as share_rate
- from t
- where sdate='202204'
- group by sdate,city_operator
- ---网格
- with t as (select distinct sdate,city_operator,area_operator,site_addr_id,is_duxiang from sqmdb_cost.tower3 where stype in ('新建及共享改造','存量注入'))
- select
- sdate,
- city_operator,
- area_operator,
- sum(case when is_duxiang='共享' then 1 else 0 end) as share_num,
- count(*) as total_num,
- sum(case when is_duxiang='共享' then 1 else 0 end)/count(*)::numeric as share_rate
- from t
- where sdate='202204'
- group by sdate,city_operator,area_operator
|