1234567891011121314151617181920212223242526272829 |
- --27、单OLT承载用户数
- ---网格
- select
- a.smonth as MONTH_ID,
- '网格' as ZB_TYPE,
- '河北' as PROV_NAME,
- dcg.city_code*100 as CITY_ID,
- dcg.city_name as CITY_NAME,
- dcg.grid_code as GRID_ID,
- dcg.grid_name as GRID_NAME,
- '27' as ZB_CODE,
- '单OLT承载用户数' as ZB_NAME,
- '否' as IS_RATIO,
- a.kd_num as QZ_FZ,
- a.olt_num as QZ_FM,
- round(a.kd_num/a.olt_num) as BY_QZ
- from
- (select
- ou.smonth,
- city_name_short(ou.city_name) as city_name,
- dgc.grid_code,
- sum(ou.kd_num) as kd_num,
- sum(ou.olt_num) as olt_num
- from sqmdb_cost.olt_user ou
- join sqmdb_cost.dict_grid_code dgc on city_name_short(ou.city_name)=dgc.city_name and trim(ou.area_name)=trim(dgc.grid_name)
- where ou.smonth='202206'
- group by ou.smonth,city_name_short(ou.city_name),dgc.grid_code) a
- join sqmdb_cost.dict_code_grid dcg on a.grid_code=dcg.grid_code
- order by dcg.city_code
|