12345678910111213141516171819202122 |
- --21、转供电占比
- ---地市(可由网格数据汇聚)
- select
- smonth,
- city_name,
- count(*) as total_num,
- sum(case when y.meter_type_name='12-01 | 转供手抄表' then 1 else 0 end) as zgd_num,
- sum(case when y.meter_type_name='12-01 | 转供手抄表' then 1 else 0 end)/count(*)::numeric as zgd_rate
- from sqmdb_cost.ytmx_new y
- group by smonth,city_name
- ---网格
- select
- smonth,
- city_name,
- area_name,
- count(*) as total_num,
- sum(case when y.meter_type_name='12-01 | 转供手抄表' then 1 else 0 end) as zgd_num,
- sum(case when y.meter_type_name='12-01 | 转供手抄表' then 1 else 0 end)/count(*)::numeric as zgd_rate
- from sqmdb_cost.ytmx_new y
- group by smonth,city_name,area_name
|