12345678910111213141516 |
- --17﹜誧歙蚾儂蹋煤
- ---華庈
- select fz.smonth,fz.sname,fz.cost_liao,fm.order_num,
- fz.cost_liao/fm.order_num as cost_order
- from
- (select smonth,sname,cost_liao from sqmdb_cost.chengben_shengnei cs
- where stype='華庈' and smonth='202203') fz
- join
- (select b.city_code,b.city_pro,a.order_num from
- (select smonth,city_code,city_name,sum(order_num)/10000 as order_num
- from sqmdb_cost.zhuangji z where smonth='202203'
- group by smonth,city_code,city_name) a
- join
- (select distinct city_code,city_pro from sqmdb_cost.dict_grid dg) b
- on a.city_code=b.city_code) fm
- on fz.sname=fm.city_pro
|