I converted column to row through union all.
It took only 0.3 seconds without union all and 24 seconds with union all.


From the explain, It seems that "union all" will query cube many times.


"without union all":
User: ADMIN
Success: true
Duration: 0.303
Project: cloud_brain
Realization Names: [CUBE[name=income_cube]]
Cuboid Ids: [56]
Total scan count: 88
Total scan bytes: 170300


 
"use union all":


User: ADMIN
Success: true
Duration: 24.311
Project: cloud_brain
Realization Names: [CUBE[name=income_cube], CUBE[name=income_cube], 
CUBE[name=income_cube], CUBE[name=income_cube], CUBE[name=income_cube], 
CUBE[name=income_cube], CUBE[name=income_cube], CUBE[name=income_cube], 
CUBE[name=income_cube], CUBE[name=income_cube], CUBE[name=income_cube], 
CUBE[name=income_cube], CUBE[name=income_cube], CUBE[name=income_cube], 
CUBE[name=income_cube], CUBE[name=income_cube], CUBE[name=income_cube], 
CUBE[name=income_cube], CUBE[name=income_cube], CUBE[name=income_cube], 
CUBE[name=income_cube], CUBE[name=income_cube], CUBE[name=income_cube], 
CUBE[name=income_cube], CUBE[name=income_cube], CUBE[name=income_cube], 
CUBE[name=income_cube], CUBE[name=income_cube], CUBE[name=income_cube], 
CUBE[name=income_cube], CUBE[name=income_cube], CUBE[name=income_cube], 
CUBE[name=income_cube], CUBE[name=income_cube], CUBE[name=income_cube], 
CUBE[name=income_cube], CUBE[name=income_cube], CUBE[name=income_cube], 
CUBE[name=income_cube], CUBE[name=income_cube], CUBE[name=income_cube], 
CUBE[name=income_cube], CUBE[name=income_cube], CUBE[name=income_cube], 
CUBE[name=income_cube], CUBE[name=income_cube], CUBE[name=income_cube], 
CUBE[name=income_cube], CUBE[name=income_cube], CUBE[name=income_cube], 
CUBE[name=income_cube], CUBE[name=income_cube], CUBE[name=income_cube], 
CUBE[name=income_cube], CUBE[name=income_cube], CUBE[name=income_cube], 
CUBE[name=income_cube], CUBE[name=income_cube], CUBE[name=income_cube], 
CUBE[name=income_cube], CUBE[name=income_cube], CUBE[name=income_cube], 
CUBE[name=income_cube], CUBE[name=income_cube], CUBE[name=income_cube], 
CUBE[name=income_cube], CUBE[name=income_cube], CUBE[name=income_cube], 
CUBE[name=income_cube], CUBE[name=income_cube], CUBE[name=income_cube], 
CUBE[name=income_cube]]
Cuboid Ids: [56]
Total scan count: 6336
Total scan bytes: 12261600




sql:
with tb_result_01 AS(
select 
 case when c202012_213 = 0 then 1 else round(COALESCE(cast(c202012_1 as 
decimal(38,4)) / cast(c202012_213 as decimal(38,4)) ,0), 4) end 
r_temperature_202012
,case when c202011_213 = 0 then 1 else round(COALESCE(cast(c202011_1 as 
decimal(38,4)) / cast(c202011_213 as decimal(38,4)) ,0), 4) end 
r_temperature_202011
,case when c202010_213 = 0 then 1 else round(COALESCE(cast(c202010_1 as 
decimal(38,4)) / cast(c202010_213 as decimal(38,4)) ,0), 4) end 
r_temperature_202010
,case when c202009_213 = 0 then 1 else round(COALESCE(cast(c202009_1 as 
decimal(38,4)) / cast(c202009_213 as decimal(38,4)) ,0), 4) end 
r_temperature_202009
,case when c202008_213 = 0 then 1 else round(COALESCE(cast(c202008_1 as 
decimal(38,4)) / cast(c202008_213 as decimal(38,4)) ,0), 4) end 
r_temperature_202008
,case when c202007_213 = 0 then 1 else round(COALESCE(cast(c202007_1 as 
decimal(38,4)) / cast(c202007_213 as decimal(38,4)) ,0), 4) end 
r_temperature_202007
,case when c202006_213 = 0 then 1 else round(COALESCE(cast(c202006_1 as 
decimal(38,4)) / cast(c202006_213 as decimal(38,4)) ,0), 4) end 
r_temperature_202006
,case when c202005_213 = 0 then 1 else round(COALESCE(cast(c202005_1 as 
decimal(38,4)) / cast(c202005_213 as decimal(38,4)) ,0), 4) end 
r_temperature_202005
,case when c202004_213 = 0 then 1 else round(COALESCE(cast(c202004_1 as 
decimal(38,4)) / cast(c202004_213 as decimal(38,4)) ,0), 4) end 
r_temperature_202004
,case when c202003_213 = 0 then 1 else round(COALESCE(cast(c202003_1 as 
decimal(38,4)) / cast(c202003_213 as decimal(38,4)) ,0), 4) end 
r_temperature_202003
,case when c202002_213 = 0 then 1 else round(COALESCE(cast(c202002_1 as 
decimal(38,4)) / cast(c202002_213 as decimal(38,4)) ,0), 4) end 
r_temperature_202002
,case when c202001_213 = 0 then 1 else round(COALESCE(cast(c202001_1 as 
decimal(38,4)) / cast(c202001_213 as decimal(38,4)) ,0), 4) end 
r_temperature_202001


,case when c201912_213 = 0 then 1 else round(COALESCE(cast(c201912_1 as 
decimal(38,4)) / cast(c201912_213 as decimal(38,4)) ,0), 4) end 
r_temperature_201912
,case when c201911_213 = 0 then 1 else round(COALESCE(cast(c201911_1 as 
decimal(38,4)) / cast(c201911_213 as decimal(38,4)) ,0), 4) end 
r_temperature_201911
,case when c201910_213 = 0 then 1 else round(COALESCE(cast(c201910_1 as 
decimal(38,4)) / cast(c201910_213 as decimal(38,4)) ,0), 4) end 
r_temperature_201910
,case when c201909_213 = 0 then 1 else round(COALESCE(cast(c201909_1 as 
decimal(38,4)) / cast(c201909_213 as decimal(38,4)) ,0), 4) end 
r_temperature_201909
,case when c201908_213 = 0 then 1 else round(COALESCE(cast(c201908_1 as 
decimal(38,4)) / cast(c201908_213 as decimal(38,4)) ,0), 4) end 
r_temperature_201908
,case when c201907_213 = 0 then 1 else round(COALESCE(cast(c201907_1 as 
decimal(38,4)) / cast(c201907_213 as decimal(38,4)) ,0), 4) end 
r_temperature_201907
,case when c201906_213 = 0 then 1 else round(COALESCE(cast(c201906_1 as 
decimal(38,4)) / cast(c201906_213 as decimal(38,4)) ,0), 4) end 
r_temperature_201906
,case when c201905_213 = 0 then 1 else round(COALESCE(cast(c201905_1 as 
decimal(38,4)) / cast(c201905_213 as decimal(38,4)) ,0), 4) end 
r_temperature_201905
,case when c201904_213 = 0 then 1 else round(COALESCE(cast(c201904_1 as 
decimal(38,4)) / cast(c201904_213 as decimal(38,4)) ,0), 4) end 
r_temperature_201904
,case when c201903_213 = 0 then 1 else round(COALESCE(cast(c201903_1 as 
decimal(38,4)) / cast(c201903_213 as decimal(38,4)) ,0), 4) end 
r_temperature_201903
,case when c201902_213 = 0 then 1 else round(COALESCE(cast(c201902_1 as 
decimal(38,4)) / cast(c201902_213 as decimal(38,4)) ,0), 4) end 
r_temperature_201902
,case when c201901_213 = 0 then 1 else round(COALESCE(cast(c201901_1 as 
decimal(38,4)) / cast(c201901_213 as decimal(38,4)) ,0), 4) end 
r_temperature_201901


,case when c201812_213 = 0 then 1 else round(COALESCE(cast(c201812_1 as 
decimal(38,4)) / cast(c201812_213 as decimal(38,4)) ,0), 4) end 
r_temperature_201812
,case when c201811_213 = 0 then 1 else round(COALESCE(cast(c201811_1 as 
decimal(38,4)) / cast(c201811_213 as decimal(38,4)) ,0), 4) end 
r_temperature_201811
,case when c201810_213 = 0 then 1 else round(COALESCE(cast(c201810_1 as 
decimal(38,4)) / cast(c201810_213 as decimal(38,4)) ,0), 4) end 
r_temperature_201810
,case when c201809_213 = 0 then 1 else round(COALESCE(cast(c201809_1 as 
decimal(38,4)) / cast(c201809_213 as decimal(38,4)) ,0), 4) end 
r_temperature_201809
,case when c201808_213 = 0 then 1 else round(COALESCE(cast(c201808_1 as 
decimal(38,4)) / cast(c201808_213 as decimal(38,4)) ,0), 4) end 
r_temperature_201808
,case when c201807_213 = 0 then 1 else round(COALESCE(cast(c201807_1 as 
decimal(38,4)) / cast(c201807_213 as decimal(38,4)) ,0), 4) end 
r_temperature_201807
,case when c201806_213 = 0 then 1 else round(COALESCE(cast(c201806_1 as 
decimal(38,4)) / cast(c201806_213 as decimal(38,4)) ,0), 4) end 
r_temperature_201806
,case when c201805_213 = 0 then 1 else round(COALESCE(cast(c201805_1 as 
decimal(38,4)) / cast(c201805_213 as decimal(38,4)) ,0), 4) end 
r_temperature_201805
,case when c201804_213 = 0 then 1 else round(COALESCE(cast(c201804_1 as 
decimal(38,4)) / cast(c201804_213 as decimal(38,4)) ,0), 4) end 
r_temperature_201804
,case when c201803_213 = 0 then 1 else round(COALESCE(cast(c201803_1 as 
decimal(38,4)) / cast(c201803_213 as decimal(38,4)) ,0), 4) end 
r_temperature_201803
,case when c201802_213 = 0 then 1 else round(COALESCE(cast(c201802_1 as 
decimal(38,4)) / cast(c201802_213 as decimal(38,4)) ,0), 4) end 
r_temperature_201802
,case when c201801_213 = 0 then 1 else round(COALESCE(cast(c201801_1 as 
decimal(38,4)) / cast(c201801_213 as decimal(38,4)) ,0), 4) end 
r_temperature_201801


from(
select tenant_id
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['202011|202010|202009|202008|202007|202006|202005|202004|202003|202002|202001|201912','202012|202011|202010|202009|202008|202007|202006|202005|202004|202003|202002|202001'])
 as c202012_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['202011|202010|202009|202008|202007|202006|202005|202004|202003|202002|202001|201912'])
 as c202012_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['202010|202009|202008|202007|202006|202005|202004|202003|202002|202001|201912|201911','202011|202010|202009|202008|202007|202006|202005|202004|202003|202002|202001|201912'])
 as c202011_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['202010|202009|202008|202007|202006|202005|202004|202003|202002|202001|201912|201911'])
 as c202011_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['202009|202008|202007|202006|202005|202004|202003|202002|202001|201912|201911|201910','202010|202009|202008|202007|202006|202005|202004|202003|202002|202001|201912|201911'])
 as c202010_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['202009|202008|202007|202006|202005|202004|202003|202002|202001|201912|201911|201910'])
 as c202010_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['202008|202007|202006|202005|202004|202003|202002|202001|201912|201911|201910|201909','202009|202008|202007|202006|202005|202004|202003|202002|202001|201912|201911|201910'])
 as c202009_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['202008|202007|202006|202005|202004|202003|202002|202001|201912|201911|201910|201909'])
 as c202009_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['202007|202006|202005|202004|202003|202002|202001|201912|201911|201910|201909|201908','202008|202007|202006|202005|202004|202003|202002|202001|201912|201911|201910|201909'])
 as c202008_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['202007|202006|202005|202004|202003|202002|202001|201912|201911|201910|201909|201908'])
 as c202008_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['202006|202005|202004|202003|202002|202001|201912|201911|201910|201909|201908|201907','202007|202006|202005|202004|202003|202002|202001|201912|201911|201910|201909|201908'])
 as c202007_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['202006|202005|202004|202003|202002|202001|201912|201911|201910|201909|201908|201907'])
 as c202007_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['202005|202004|202003|202002|202001|201912|201911|201910|201909|201908|201907|201906','202006|202005|202004|202003|202002|202001|201912|201911|201910|201909|201908|201907'])
 as c202006_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['202005|202004|202003|202002|202001|201912|201911|201910|201909|201908|201907|201906'])
 as c202006_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['202004|202003|202002|202001|201912|201911|201910|201909|201908|201907|201906|201905','202005|202004|202003|202002|202001|201912|201911|201910|201909|201908|201907|201906'])
 as c202005_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['202004|202003|202002|202001|201912|201911|201910|201909|201908|201907|201906|201905'])
 as c202005_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['202003|202002|202001|201912|201911|201910|201909|201908|201907|201906|201905|201904','202004|202003|202002|202001|201912|201911|201910|201909|201908|201907|201906|201905'])
 as c202004_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['202003|202002|202001|201912|201911|201910|201909|201908|201907|201906|201905|201904'])
 as c202004_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['202002|202001|201912|201911|201910|201909|201908|201907|201906|201905|201904|201903','202003|202002|202001|201912|201911|201910|201909|201908|201907|201906|201905|201904'])
 as c202003_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['202002|202001|201912|201911|201910|201909|201908|201907|201906|201905|201904|201903'])
 as c202003_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['202001|201912|201911|201910|201909|201908|201907|201906|201905|201904|201903|201902','202002|202001|201912|201911|201910|201909|201908|201907|201906|201905|201904|201903'])
 as c202002_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['202001|201912|201911|201910|201909|201908|201907|201906|201905|201904|201903|201902'])
 as c202002_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201912|201911|201910|201909|201908|201907|201906|201905|201904|201903|201902|201901','202001|201912|201911|201910|201909|201908|201907|201906|201905|201904|201903|201902'])
 as c202001_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201912|201911|201910|201909|201908|201907|201906|201905|201904|201903|201902|201901'])
 as c202001_213


,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201911|201910|201909|201908|201907|201906|201905|201904|201903|201902|201901|201812','201912|201911|201910|201909|201908|201907|201906|201905|201904|201903|201902|201901'])
 as c201912_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201911|201910|201909|201908|201907|201906|201905|201904|201903|201902|201901|201812'])
 as c201912_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201910|201909|201908|201907|201906|201905|201904|201903|201902|201901|201812|201811','201911|201910|201909|201908|201907|201906|201905|201904|201903|201902|201901|201812'])
 as c201911_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201910|201909|201908|201907|201906|201905|201904|201903|201902|201901|201812|201811'])
 as c201911_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201909|201908|201907|201906|201905|201904|201903|201902|201901|201812|201811|201810','201910|201909|201908|201907|201906|201905|201904|201903|201902|201901|201812|201811'])
 as c201910_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201909|201908|201907|201906|201905|201904|201903|201902|201901|201812|201811|201810'])
 as c201910_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201908|201907|201906|201905|201904|201903|201902|201901|201812|201811|201810|201809','201909|201908|201907|201906|201905|201904|201903|201902|201901|201812|201811|201810'])
 as c201909_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201908|201907|201906|201905|201904|201903|201902|201901|201812|201811|201810|201809'])
 as c201909_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201907|201906|201905|201904|201903|201902|201901|201812|201811|201810|201809|201808','201908|201907|201906|201905|201904|201903|201902|201901|201812|201811|201810|201809'])
 as c201908_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201907|201906|201905|201904|201903|201902|201901|201812|201811|201810|201809|201808'])
 as c201908_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201906|201905|201904|201903|201902|201901|201812|201811|201810|201809|201808|201807','201907|201906|201905|201904|201903|201902|201901|201812|201811|201810|201809|201808'])
 as c201907_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201906|201905|201904|201903|201902|201901|201812|201811|201810|201809|201808|201807'])
 as c201907_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201905|201904|201903|201902|201901|201812|201811|201810|201809|201808|201807|201806','201906|201905|201904|201903|201902|201901|201812|201811|201810|201809|201808|201807'])
 as c201906_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201905|201904|201903|201902|201901|201812|201811|201810|201809|201808|201807|201806'])
 as c201906_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201904|201903|201902|201901|201812|201811|201810|201809|201808|201807|201806|201805','201905|201904|201903|201902|201901|201812|201811|201810|201809|201808|201807|201806'])
 as c201905_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201904|201903|201902|201901|201812|201811|201810|201809|201808|201807|201806|201805'])
 as c201905_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201903|201902|201901|201812|201811|201810|201809|201808|201807|201806|201805|201804','201904|201903|201902|201901|201812|201811|201810|201809|201808|201807|201806|201805'])
 as c201904_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201903|201902|201901|201812|201811|201810|201809|201808|201807|201806|201805|201804'])
 as c201904_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201902|201901|201812|201811|201810|201809|201808|201807|201806|201805|201804|201803','201903|201902|201901|201812|201811|201810|201809|201808|201807|201806|201805|201804'])
 as c201903_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201902|201901|201812|201811|201810|201809|201808|201807|201806|201805|201804|201803'])
 as c201903_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201901|201812|201811|201810|201809|201808|201807|201806|201805|201804|201803|201802','201902|201901|201812|201811|201810|201809|201808|201807|201806|201805|201804|201803'])
 as c201902_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201901|201812|201811|201810|201809|201808|201807|201806|201805|201804|201803|201802'])
 as c201902_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201812|201811|201810|201809|201808|201807|201806|201805|201804|201803|201802|201801','201901|201812|201811|201810|201809|201808|201807|201806|201805|201804|201803|201802'])
 as c201901_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201812|201811|201810|201809|201808|201807|201806|201805|201804|201803|201802|201801'])
 as c201901_213


,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201811|201810|201809|201808|201807|201806|201805|201804|201803|201802|201801|201712','201812|201811|201810|201809|201808|201807|201806|201805|201804|201803|201802|201801'])
 as c201812_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201811|201810|201809|201808|201807|201806|201805|201804|201803|201802|201801|201712'])
 as c201812_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201810|201809|201808|201807|201806|201805|201804|201803|201802|201801|201712|201711','201811|201810|201809|201808|201807|201806|201805|201804|201803|201802|201801|201712'])
 as c201811_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201810|201809|201808|201807|201806|201805|201804|201803|201802|201801|201712|201711'])
 as c201811_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201809|201808|201807|201806|201805|201804|201803|201802|201801|201712|201711|201710','201810|201809|201808|201807|201806|201805|201804|201803|201802|201801|201712|201711'])
 as c201810_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201809|201808|201807|201806|201805|201804|201803|201802|201801|201712|201711|201710'])
 as c201810_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201808|201807|201806|201805|201804|201803|201802|201801|201712|201711|201710|201709','201809|201808|201807|201806|201805|201804|201803|201802|201801|201712|201711|201710'])
 as c201809_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201808|201807|201806|201805|201804|201803|201802|201801|201712|201711|201710|201709'])
 as c201809_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201807|201806|201805|201804|201803|201802|201801|201712|201711|201710|201709|201708','201808|201807|201806|201805|201804|201803|201802|201801|201712|201711|201710|201709'])
 as c201808_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201807|201806|201805|201804|201803|201802|201801|201712|201711|201710|201709|201708'])
 as c201808_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201806|201805|201804|201803|201802|201801|201712|201711|201710|201709|201708|201707','201807|201806|201805|201804|201803|201802|201801|201712|201711|201710|201709|201708'])
 as c201807_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201806|201805|201804|201803|201802|201801|201712|201711|201710|201709|201708|201707'])
 as c201807_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201805|201804|201803|201802|201801|201712|201711|201710|201709|201708|201707|201706','201806|201805|201804|201803|201802|201801|201712|201711|201710|201709|201708|201707'])
 as c201806_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201805|201804|201803|201802|201801|201712|201711|201710|201709|201708|201707|201706'])
 as c201806_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201804|201803|201802|201801|201712|201711|201710|201709|201708|201707|201706|201705','201805|201804|201803|201802|201801|201712|201711|201710|201709|201708|201707|201706'])
 as c201805_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201804|201803|201802|201801|201712|201711|201710|201709|201708|201707|201706|201705'])
 as c201805_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201803|201802|201801|201712|201711|201710|201709|201708|201707|201706|201705|201704','201804|201803|201802|201801|201712|201711|201710|201709|201708|201707|201706|201705'])
 as c201804_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201803|201802|201801|201712|201711|201710|201709|201708|201707|201706|201705|201704'])
 as c201804_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201802|201801|201712|201711|201710|201709|201708|201707|201706|201705|201704|201703','201803|201802|201801|201712|201711|201710|201709|201708|201707|201706|201705|201704'])
 as c201803_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201802|201801|201712|201711|201710|201709|201708|201707|201706|201705|201704|201703'])
 as c201803_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201801|201712|201711|201710|201709|201708|201707|201706|201705|201704|201703|201702','201802|201801|201712|201711|201710|201709|201708|201707|201706|201705|201704|201703'])
 as c201802_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201801|201712|201711|201710|201709|201708|201707|201706|201705|201704|201703|201702'])
 as c201802_213
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201712|201711|201710|201709|201708|201707|201706|201705|201704|201703|201702|201701','201801|201712|201711|201710|201709|201708|201707|201706|201705|201704|201703|201702'])
 as c201801_1
,INTERSECT_COUNT(gmfmc, kprq_month, 
array['201712|201711|201710|201709|201708|201707|201706|201705|201704|201703|201702|201701'])
 as c201801_213


from 
bw_cloud_brain.income_analysis 
where 1=1
 and tenant_id = 1700001093562
group by tenant_id
) a
)


select '202012' r_month ,'??????' r_city, r_temperature_202012 r_temperature 
from tb_result_01 
union all
select '202011' r_month ,'??????' r_city, r_temperature_202011 r_temperature 
from tb_result_01 
union all
select '202010' r_month ,'??????' r_city, r_temperature_202010 r_temperature 
from tb_result_01 
union all
select '202009' r_month ,'??????' r_city, r_temperature_202009 r_temperature 
from tb_result_01 
union all
select '202008' r_month ,'??????' r_city, r_temperature_202008 r_temperature 
from tb_result_01 
union all
select '202007' r_month ,'??????' r_city, r_temperature_202007 r_temperature 
from tb_result_01 
union all
select '202006' r_month ,'??????' r_city, r_temperature_202006 r_temperature 
from tb_result_01 
union all
select '202005' r_month ,'??????' r_city, r_temperature_202005 r_temperature 
from tb_result_01 
union all
select '202004' r_month ,'??????' r_city, r_temperature_202004 r_temperature 
from tb_result_01 
union all
select '202003' r_month ,'??????' r_city, r_temperature_202003 r_temperature 
from tb_result_01 
union all
select '202002' r_month ,'??????' r_city, r_temperature_202002 r_temperature 
from tb_result_01 
union all
select '202001' r_month ,'??????' r_city, r_temperature_202001 r_temperature 
from tb_result_01 


union all
select '201912' r_month ,'??????' r_city, r_temperature_201912 r_temperature 
from tb_result_01 
union all
select '201911' r_month ,'??????' r_city, r_temperature_201911 r_temperature 
from tb_result_01 
union all
select '201910' r_month ,'??????' r_city, r_temperature_201910 r_temperature 
from tb_result_01 
union all
select '201909' r_month ,'??????' r_city, r_temperature_201909 r_temperature 
from tb_result_01 
union all
select '201908' r_month ,'??????' r_city, r_temperature_201908 r_temperature 
from tb_result_01 
union all
select '201907' r_month ,'??????' r_city, r_temperature_201907 r_temperature 
from tb_result_01 
union all
select '201906' r_month ,'??????' r_city, r_temperature_201906 r_temperature 
from tb_result_01 
union all
select '201905' r_month ,'??????' r_city, r_temperature_201905 r_temperature 
from tb_result_01 
union all
select '201904' r_month ,'??????' r_city, r_temperature_201904 r_temperature 
from tb_result_01 
union all
select '201903' r_month ,'??????' r_city, r_temperature_201903 r_temperature 
from tb_result_01 
union all
select '201902' r_month ,'??????' r_city, r_temperature_201902 r_temperature 
from tb_result_01 
union all
select '201901' r_month ,'??????' r_city, r_temperature_201901 r_temperature 
from tb_result_01 


union all
select '201812' r_month ,'??????' r_city, r_temperature_201812 r_temperature 
from tb_result_01 
union all
select '201811' r_month ,'??????' r_city, r_temperature_201811 r_temperature 
from tb_result_01 
union all
select '201810' r_month ,'??????' r_city, r_temperature_201810 r_temperature 
from tb_result_01 
union all
select '201809' r_month ,'??????' r_city, r_temperature_201809 r_temperature 
from tb_result_01 
union all
select '201808' r_month ,'??????' r_city, r_temperature_201808 r_temperature 
from tb_result_01 
union all
select '201807' r_month ,'??????' r_city, r_temperature_201807 r_temperature 
from tb_result_01 
union all
select '201806' r_month ,'??????' r_city, r_temperature_201806 r_temperature 
from tb_result_01 
union all
select '201805' r_month ,'??????' r_city, r_temperature_201805 r_temperature 
from tb_result_01 
union all
select '201804' r_month ,'??????' r_city, r_temperature_201804 r_temperature 
from tb_result_01 
union all
select '201803' r_month ,'??????' r_city, r_temperature_201803 r_temperature 
from tb_result_01 
union all
select '201802' r_month ,'??????' r_city, r_temperature_201802 r_temperature 
from tb_result_01 
union all
select '201801' r_month ,'??????' r_city, r_temperature_201801 r_temperature 
from tb_result_01 

Reply via email to