--CREATE TABLE ads.ALS_XXH_CANCEL_NEW_C4_lowDim ENGINE = MergeTree
--PARTITION BY TARGET_MONTH
--ORDER BY USERID as
insert into ads.ALS_XXH_CANCEL_NEW_C4_lowDim
select
TARGET_MONTH,USERID,PRICE,MAXFLOW,TOTAL_FEE_AVG,IS_ACCT_AVG,
PROVINCE,CHANNEL,CPID,SPID,DIFF_MONYH_TYPE,CUST_SEX,CERT_AGE,MANU_NAME,BELONGTO,CPTYPE,
IS_VIP,MPer1_Flow,MAvg3_Flow,M1_Flow02,pprice,PACKAGE_PRICE_TYPE,H_FLUX_TYPE,IS_DAWANG,
'+++流量+++' as cl1,
--MPer3_TOTAL_FLUX,MPer3_TOTAL_VIDEO_FLUX,
--TOTAL_FLUX 99000  TOTAL_FLUX_VIDEO 50000
MAvg_TOTAL_FLUX_1_3,
if(MAvg_TOTAL_FLUX_1_3>99000,99000,MAvg_TOTAL_FLUX_1_3)/99000 as MAvg_TOTAL_FLUX_1_3_zs,
ifNull(MPer1_TOTAL_FLUX,MAvg_TOTAL_FLUX_1_3) as MPer1_TOTAL_FLUX,
if(MPer1_TOTAL_FLUX>99000,99000,MPer1_TOTAL_FLUX)/99000 as MPer1_TOTAL_FLUX_zs,
MAvg_TOTAL_VIDEO_FLUX_1_3,
if(MAvg_TOTAL_VIDEO_FLUX_1_3>50000,50000,MAvg_TOTAL_VIDEO_FLUX_1_3)/50000 as MAvg_TOTAL_VIDEO_FLUX_1_3_zs,
ifNull(MPer1_TOTAL_VIDEO_FLUX,MAvg_TOTAL_VIDEO_FLUX_1_3) as MPer1_TOTAL_VIDEO_FLUX,
if(MPer1_TOTAL_VIDEO_FLUX>50000,50000,MPer1_TOTAL_VIDEO_FLUX)/50000 as MPer1_TOTAL_VIDEO_FLUX_zs,
--分桶nan 0  1 2 5 10 20 50 +
Mavg_TOTAL_FLUX_GRAD_1_3,
multiIf(isNaN(Mavg_TOTAL_FLUX_GRAD_1_3),'Mavg_TOTAL_FLUX_GRAD_1_3_vNAN',Mavg_TOTAL_FLUX_GRAD_1_3=0 ,'Mavg_TOTAL_FLUX_GRAD_1_3_v0',
Mavg_TOTAL_FLUX_GRAD_1_3>0 and Mavg_TOTAL_FLUX_GRAD_1_3<=1000,'Mavg_TOTAL_FLUX_GRAD_1_3_正0_1',Mavg_TOTAL_FLUX_GRAD_1_3>1000 and Mavg_TOTAL_FLUX_GRAD_1_3<=2000,'Mavg_TOTAL_FLUX_GRAD_1_3_正1_2',
Mavg_TOTAL_FLUX_GRAD_1_3>2000 and Mavg_TOTAL_FLUX_GRAD_1_3<=5000,'Mavg_TOTAL_FLUX_GRAD_1_3_正2_5',Mavg_TOTAL_FLUX_GRAD_1_3>5000 and Mavg_TOTAL_FLUX_GRAD_1_3<=10000,'Mavg_TOTAL_FLUX_GRAD_1_3_正5_10',
Mavg_TOTAL_FLUX_GRAD_1_3>10000 and Mavg_TOTAL_FLUX_GRAD_1_3<=20000,'Mavg_TOTAL_FLUX_GRAD_1_3_正10_20',Mavg_TOTAL_FLUX_GRAD_1_3>20000 and Mavg_TOTAL_FLUX_GRAD_1_3<=50000,'Mavg_TOTAL_FLUX_GRAD_1_3_正20_50',
Mavg_TOTAL_FLUX_GRAD_1_3>50000 ,'Mavg_TOTAL_FLUX_GRAD_1_3_正50_p',
Mavg_TOTAL_FLUX_GRAD_1_3<0 and Mavg_TOTAL_FLUX_GRAD_1_3>=-1000,'Mavg_TOTAL_FLUX_GRAD_1_3_负0_1',Mavg_TOTAL_FLUX_GRAD_1_3<-1000 and Mavg_TOTAL_FLUX_GRAD_1_3>=-2000,'Mavg_TOTAL_FLUX_GRAD_1_3_负1_2',
Mavg_TOTAL_FLUX_GRAD_1_3<-2000 and Mavg_TOTAL_FLUX_GRAD_1_3>=-5000,'Mavg_TOTAL_FLUX_GRAD_1_3_负2_5',Mavg_TOTAL_FLUX_GRAD_1_3<-5000 and Mavg_TOTAL_FLUX_GRAD_1_3>=-10000,'Mavg_TOTAL_FLUX_GRAD_1_3_负5_10',
Mavg_TOTAL_FLUX_GRAD_1_3<-10000 and Mavg_TOTAL_FLUX_GRAD_1_3>=-20000,'Mavg_TOTAL_FLUX_GRAD_1_3_负10_20',Mavg_TOTAL_FLUX_GRAD_1_3<-20000 and Mavg_TOTAL_FLUX_GRAD_1_3>=-50000,'Mavg_TOTAL_FLUX_GRAD_1_3_负20_50',
Mavg_TOTAL_FLUX_GRAD_1_3<-50000 ,'Mavg_TOTAL_FLUX_GRAD_1_3_负50_p','xxx') as Mavg_TOTAL_FLUX_GRAD_1_3_TYPE,
--
Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3,
multiIf(isNaN(Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3),'Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3_vNAN',Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3=0 ,'Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3_v0',
Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3>0 and Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3<=1000,'Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3_正0_1',Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3>1000 and Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3<=2000,'Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3_正1_2',
Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3>2000 and Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3<=5000,'Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3_正2_5',Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3>5000 and Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3<=10000,'Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3_正5_10',
Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3>10000 and Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3<=20000,'Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3_正10_20',Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3>20000 and Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3<=50000,'Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3_正20_50',
Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3>50000 ,'Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3_正50_p',
Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3<0 and Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3>=-1000,'Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3_负0_1',Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3<-1000 and Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3>=-2000,'Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3_负1_2',
Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3<-2000 and Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3>=-5000,'Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3_负2_5',Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3<-5000 and Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3>=-10000,'Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3_负5_10',
Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3<-10000 and Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3>=-20000,'Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3_负10_20',Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3<-20000 and Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3>=-50000,'Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3_负20_50',
Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3<-50000 ,'Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3_负50_p','xxx') as Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3_TYPE,
if(arrayReduce('avg',[Div_vFlux_tFlux_1_3,DivAvg_vFlux_tFlux_1_3])>1,1,arrayReduce('avg',[Div_vFlux_tFlux_1_3,DivAvg_vFlux_tFlux_1_3])) as Div_vFlux_tFlux_1_3,


MAvg_TOTAL_FLUX_2_4,
if(MAvg_TOTAL_FLUX_2_4>99000,99000,MAvg_TOTAL_FLUX_2_4)/99000 as MAvg_TOTAL_FLUX_2_4_zs,
ifNull(MPer2_TOTAL_FLUX,MAvg_TOTAL_FLUX_2_4) as MPer2_TOTAL_FLUX,
if(MPer2_TOTAL_FLUX>99000,99000,MPer2_TOTAL_FLUX)/99000 as MPer2_TOTAL_FLUX_zs,
MAvg_TOTAL_VIDEO_FLUX_2_4,
if(MAvg_TOTAL_VIDEO_FLUX_2_4>50000,50000,MAvg_TOTAL_VIDEO_FLUX_2_4)/50000 as MAvg_TOTAL_VIDEO_FLUX_2_4_zs,
ifNull(MPer2_TOTAL_VIDEO_FLUX,MAvg_TOTAL_VIDEO_FLUX_2_4) as MPer2_TOTAL_VIDEO_FLUX,
if(MPer2_TOTAL_VIDEO_FLUX>50000,50000,MPer2_TOTAL_VIDEO_FLUX)/50000 as MPer2_TOTAL_VIDEO_FLUX_zs,
--分桶nan 0  1 2 5 10 20 50 +
Mavg_TOTAL_FLUX_GRAD_2_4,
multiIf(isNaN(Mavg_TOTAL_FLUX_GRAD_2_4),'Mavg_TOTAL_FLUX_GRAD_2_4_vNAN',Mavg_TOTAL_FLUX_GRAD_2_4=0 ,'Mavg_TOTAL_FLUX_GRAD_2_4_v0',
Mavg_TOTAL_FLUX_GRAD_2_4>0 and Mavg_TOTAL_FLUX_GRAD_2_4<=1000,'Mavg_TOTAL_FLUX_GRAD_2_4_正0_1',Mavg_TOTAL_FLUX_GRAD_2_4>1000 and Mavg_TOTAL_FLUX_GRAD_2_4<=2000,'Mavg_TOTAL_FLUX_GRAD_2_4_正1_2',
Mavg_TOTAL_FLUX_GRAD_2_4>2000 and Mavg_TOTAL_FLUX_GRAD_2_4<=5000,'Mavg_TOTAL_FLUX_GRAD_2_4_正2_5',Mavg_TOTAL_FLUX_GRAD_2_4>5000 and Mavg_TOTAL_FLUX_GRAD_2_4<=10000,'Mavg_TOTAL_FLUX_GRAD_2_4_正5_10',
Mavg_TOTAL_FLUX_GRAD_2_4>10000 and Mavg_TOTAL_FLUX_GRAD_2_4<=20000,'Mavg_TOTAL_FLUX_GRAD_2_4_正10_20',Mavg_TOTAL_FLUX_GRAD_2_4>20000 and Mavg_TOTAL_FLUX_GRAD_2_4<=50000,'Mavg_TOTAL_FLUX_GRAD_2_4_正20_50',
Mavg_TOTAL_FLUX_GRAD_2_4>50000 ,'Mavg_TOTAL_FLUX_GRAD_2_4_正50_p',
Mavg_TOTAL_FLUX_GRAD_2_4<0 and Mavg_TOTAL_FLUX_GRAD_2_4>=-1000,'Mavg_TOTAL_FLUX_GRAD_2_4_负0_1',Mavg_TOTAL_FLUX_GRAD_2_4<-1000 and Mavg_TOTAL_FLUX_GRAD_2_4>=-2000,'Mavg_TOTAL_FLUX_GRAD_2_4_负1_2',
Mavg_TOTAL_FLUX_GRAD_2_4<-2000 and Mavg_TOTAL_FLUX_GRAD_2_4>=-5000,'Mavg_TOTAL_FLUX_GRAD_2_4_负2_5',Mavg_TOTAL_FLUX_GRAD_2_4<-5000 and Mavg_TOTAL_FLUX_GRAD_2_4>=-10000,'Mavg_TOTAL_FLUX_GRAD_2_4_负5_10',
Mavg_TOTAL_FLUX_GRAD_2_4<-10000 and Mavg_TOTAL_FLUX_GRAD_2_4>=-20000,'Mavg_TOTAL_FLUX_GRAD_2_4_负10_20',Mavg_TOTAL_FLUX_GRAD_2_4<-20000 and Mavg_TOTAL_FLUX_GRAD_2_4>=-50000,'Mavg_TOTAL_FLUX_GRAD_2_4_负20_50',
Mavg_TOTAL_FLUX_GRAD_2_4<-50000 ,'Mavg_TOTAL_FLUX_GRAD_2_4_负50_p','xxx') as Mavg_TOTAL_FLUX_GRAD_2_4_TYPE,
--
Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4,
multiIf(isNaN(Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4),'Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4_vNAN',Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4=0 ,'Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4_v0',
Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4>0 and Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4<=1000,'Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4_正0_1',Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4>1000 and Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4<=2000,'Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4_正1_2',
Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4>2000 and Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4<=5000,'Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4_正2_5',Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4>5000 and Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4<=10000,'Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4_正5_10',
Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4>10000 and Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4<=20000,'Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4_正10_20',Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4>20000 and Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4<=50000,'Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4_正20_50',
Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4>50000 ,'Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4_正50_p',
Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4<0 and Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4>=-1000,'Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4_负0_1',Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4<-1000 and Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4>=-2000,'Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4_负1_2',
Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4<-2000 and Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4>=-5000,'Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4_负2_5',Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4<-5000 and Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4>=-10000,'Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4_负5_10',
Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4<-10000 and Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4>=-20000,'Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4_负10_20',Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4<-20000 and Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4>=-50000,'Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4_负20_50',
Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4<-50000 ,'Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4_负50_p','xxx') as Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4_TYPE,
if(arrayReduce('avg',[Div_vFlux_tFlux_2_4,DivAvg_vFlux_tFlux_2_4])>1,1,arrayReduce('avg',[Div_vFlux_tFlux_2_4,DivAvg_vFlux_tFlux_2_4])) as Div_vFlux_tFlux_2_4,
'+++快手+++' as cl2,
-- kuaishou 50   其他 20
MAvg_Flow_kuaishou_1_3,
ifNull(MPer1_Flow_kuaishou,MAvg_Flow_kuaishou_1_3) as MPer1_Flow_kuaishou,
if(MAvg_Flow_kuaishou_1_3>50000,50000,MAvg_Flow_kuaishou_1_3)/50000 as MAvg_Flow_kuaishou_1_3_zs,
if(MPer1_Flow_kuaishou>50000,50000,MPer1_Flow_kuaishou)/50000 as MPer1_Flow_kuaishou_zs,
--分桶nan 0 500 1 2 5 10 20 +
Mavg_Flow_kuaishou_GRAD_1_3,
multiIf(isNaN(Mavg_Flow_kuaishou_GRAD_1_3),'Mavg_Flow_kuaishou_GRAD_1_3_vNAN',Mavg_Flow_kuaishou_GRAD_1_3=0 ,'Mavg_Flow_kuaishou_GRAD_1_3_v0',
Mavg_Flow_kuaishou_GRAD_1_3>0 and Mavg_Flow_kuaishou_GRAD_1_3<=500,'Mavg_Flow_kuaishou_GRAD_1_3_正0_0.5',Mavg_Flow_kuaishou_GRAD_1_3>500 and Mavg_Flow_kuaishou_GRAD_1_3<=1000,'Mavg_Flow_kuaishou_GRAD_1_3_正0.5_1',
Mavg_Flow_kuaishou_GRAD_1_3>1000 and Mavg_Flow_kuaishou_GRAD_1_3<=2000,'Mavg_Flow_kuaishou_GRAD_1_3_正1_2',Mavg_Flow_kuaishou_GRAD_1_3>2000 and Mavg_Flow_kuaishou_GRAD_1_3<=5000,'Mavg_Flow_kuaishou_GRAD_1_3_正2_5',
Mavg_Flow_kuaishou_GRAD_1_3>5000 and Mavg_Flow_kuaishou_GRAD_1_3<=10000,'Mavg_Flow_kuaishou_GRAD_1_3_正5_10',Mavg_Flow_kuaishou_GRAD_1_3>10000 and Mavg_Flow_kuaishou_GRAD_1_3<=20000,'Mavg_Flow_kuaishou_GRAD_1_3_正10_20',
Mavg_Flow_kuaishou_GRAD_1_3>20000 ,'Mavg_Flow_kuaishou_GRAD_1_3_正20_p',
Mavg_Flow_kuaishou_GRAD_1_3<0 and Mavg_Flow_kuaishou_GRAD_1_3>=-500,'Mavg_Flow_kuaishou_GRAD_1_3_负0_0.5',Mavg_Flow_kuaishou_GRAD_1_3<-500 and Mavg_Flow_kuaishou_GRAD_1_3>=-1000,'Mavg_Flow_kuaishou_GRAD_1_3_负0.5_1',
Mavg_Flow_kuaishou_GRAD_1_3<-1000 and Mavg_Flow_kuaishou_GRAD_1_3>=-2000,'Mavg_Flow_kuaishou_GRAD_1_3_负1_2',Mavg_Flow_kuaishou_GRAD_1_3<-2000 and Mavg_Flow_kuaishou_GRAD_1_3>=-5000,'Mavg_Flow_kuaishou_GRAD_1_3_负2_5',
Mavg_Flow_kuaishou_GRAD_1_3<-5000 and Mavg_Flow_kuaishou_GRAD_1_3>=-10000,'Mavg_Flow_kuaishou_GRAD_1_3_负5_10',Mavg_Flow_kuaishou_GRAD_1_3<-10000 and Mavg_Flow_kuaishou_GRAD_1_3>=-20000,'Mavg_Flow_kuaishou_GRAD_1_3_负10_20',
Mavg_Flow_kuaishou_GRAD_1_3<-20000 ,'Mavg_Flow_kuaishou_GRAD_1_3_负20_p','xxx') as Mavg_Flow_kuaishou_GRAD_1_3_TYPE,
if(arrayReduce('avg',[Div_kuaishou_vFlux_1_3,DivAvg_kuaishou_vFlux_1_3])>1,1,arrayReduce('avg',[Div_kuaishou_vFlux_1_3,DivAvg_kuaishou_vFlux_1_3])) as Div_kuaishou_vFlux_1_3,
MAvg_Flow_kuaishou_2_4,
ifNull(MPer2_Flow_kuaishou,MAvg_Flow_kuaishou_2_4) as MPer2_Flow_kuaishou,
if(MAvg_Flow_kuaishou_2_4>50000,50000,MAvg_Flow_kuaishou_2_4)/50000 as MAvg_Flow_kuaishou_2_4_zs,
if(MPer2_Flow_kuaishou>50000,50000,MPer2_Flow_kuaishou)/50000 as MPer2_Flow_kuaishou_zs,
--
Mavg_Flow_kuaishou_GRAD_2_4,
multiIf(isNaN(Mavg_Flow_kuaishou_GRAD_2_4),'Mavg_Flow_kuaishou_GRAD_2_4_vNAN',Mavg_Flow_kuaishou_GRAD_2_4=0 ,'Mavg_Flow_kuaishou_GRAD_2_4_v0',
Mavg_Flow_kuaishou_GRAD_2_4>0 and Mavg_Flow_kuaishou_GRAD_2_4<=500,'Mavg_Flow_kuaishou_GRAD_2_4_正0_0.5',Mavg_Flow_kuaishou_GRAD_2_4>500 and Mavg_Flow_kuaishou_GRAD_2_4<=1000,'Mavg_Flow_kuaishou_GRAD_2_4_正0.5_1',
Mavg_Flow_kuaishou_GRAD_2_4>1000 and Mavg_Flow_kuaishou_GRAD_2_4<=2000,'Mavg_Flow_kuaishou_GRAD_2_4_正1_2',Mavg_Flow_kuaishou_GRAD_2_4>2000 and Mavg_Flow_kuaishou_GRAD_2_4<=5000,'Mavg_Flow_kuaishou_GRAD_2_4_正2_5',
Mavg_Flow_kuaishou_GRAD_2_4>5000 and Mavg_Flow_kuaishou_GRAD_2_4<=10000,'Mavg_Flow_kuaishou_GRAD_2_4_正5_10',Mavg_Flow_kuaishou_GRAD_2_4>10000 and Mavg_Flow_kuaishou_GRAD_2_4<=20000,'Mavg_Flow_kuaishou_GRAD_2_4_正10_20',
Mavg_Flow_kuaishou_GRAD_2_4>20000 ,'Mavg_Flow_kuaishou_GRAD_2_4_正20_p',
Mavg_Flow_kuaishou_GRAD_2_4<0 and Mavg_Flow_kuaishou_GRAD_2_4>=-500,'Mavg_Flow_kuaishou_GRAD_2_4_负0_0.5',Mavg_Flow_kuaishou_GRAD_2_4<-500 and Mavg_Flow_kuaishou_GRAD_2_4>=-1000,'Mavg_Flow_kuaishou_GRAD_2_4_负0.5_1',
Mavg_Flow_kuaishou_GRAD_2_4<-1000 and Mavg_Flow_kuaishou_GRAD_2_4>=-2000,'Mavg_Flow_kuaishou_GRAD_2_4_负1_2',Mavg_Flow_kuaishou_GRAD_2_4<-2000 and Mavg_Flow_kuaishou_GRAD_2_4>=-5000,'Mavg_Flow_kuaishou_GRAD_2_4_负2_5',
Mavg_Flow_kuaishou_GRAD_2_4<-5000 and Mavg_Flow_kuaishou_GRAD_2_4>=-10000,'Mavg_Flow_kuaishou_GRAD_2_4_负5_10',Mavg_Flow_kuaishou_GRAD_2_4<-10000 and Mavg_Flow_kuaishou_GRAD_2_4>=-20000,'Mavg_Flow_kuaishou_GRAD_2_4_负10_20',
Mavg_Flow_kuaishou_GRAD_2_4<-20000 ,'Mavg_Flow_kuaishou_GRAD_2_4_负20_p','xxx') as Mavg_Flow_kuaishou_GRAD_2_4_TYPE,
if(arrayReduce('avg',[Div_kuaishou_vFlux_2_4,DivAvg_kuaishou_vFlux_2_4])>1,1,arrayReduce('avg',[Div_kuaishou_vFlux_2_4,DivAvg_kuaishou_vFlux_2_4])) as Div_kuaishou_vFlux_2_4,
'+++腾讯+++' as cl3,
MAvg_Flow_tencent_1_3,
ifNull(MPer1_Flow_tencent,MAvg_Flow_tencent_1_3) as MPer1_Flow_tencent,
if(MAvg_Flow_tencent_1_3>20000,20000,MAvg_Flow_tencent_1_3)/20000 as MAvg_Flow_tencent_1_3_zs,
if(MPer1_Flow_tencent>20000,20000,MPer1_Flow_tencent)/20000 as MPer1_Flow_tencent_zs,
--分桶nan 0 500 1 2 5 10  20+
Mavg_Flow_tencent_GRAD_1_3,
multiIf(isNaN(Mavg_Flow_tencent_GRAD_1_3),'Mavg_Flow_tencent_GRAD_1_3_vNAN',Mavg_Flow_tencent_GRAD_1_3=0 ,'Mavg_Flow_tencent_GRAD_1_3_v0',
Mavg_Flow_tencent_GRAD_1_3>0 and Mavg_Flow_tencent_GRAD_1_3<=500,'Mavg_Flow_tencent_GRAD_1_3_正0_0.5',Mavg_Flow_tencent_GRAD_1_3>500 and Mavg_Flow_tencent_GRAD_1_3<=1000,'Mavg_Flow_tencent_GRAD_1_3_正0.5_1',
Mavg_Flow_tencent_GRAD_1_3>1000 and Mavg_Flow_tencent_GRAD_1_3<=2000,'Mavg_Flow_tencent_GRAD_1_3_正1_2',Mavg_Flow_tencent_GRAD_1_3>2000 and Mavg_Flow_tencent_GRAD_1_3<=5000,'Mavg_Flow_tencent_GRAD_1_3_正2_5',
Mavg_Flow_tencent_GRAD_1_3>5000 and Mavg_Flow_tencent_GRAD_1_3<=10000,'Mavg_Flow_tencent_GRAD_1_3_正5_10',Mavg_Flow_tencent_GRAD_1_3>10000 and Mavg_Flow_tencent_GRAD_1_3<=20000,'Mavg_Flow_tencent_GRAD_1_3_正10_20',
Mavg_Flow_tencent_GRAD_1_3>20000 ,'Mavg_Flow_tencent_GRAD_1_3_正20_p',
Mavg_Flow_tencent_GRAD_1_3<0 and Mavg_Flow_tencent_GRAD_1_3>=-500,'Mavg_Flow_tencent_GRAD_1_3_负0_0.5',Mavg_Flow_tencent_GRAD_1_3<-500 and Mavg_Flow_tencent_GRAD_1_3>=-1000,'Mavg_Flow_tencent_GRAD_1_3_负0.5_1',
Mavg_Flow_tencent_GRAD_1_3<-1000 and Mavg_Flow_tencent_GRAD_1_3>=-2000,'Mavg_Flow_tencent_GRAD_1_3_负1_2',Mavg_Flow_tencent_GRAD_1_3<-2000 and Mavg_Flow_tencent_GRAD_1_3>=-5000,'Mavg_Flow_tencent_GRAD_1_3_负2_5',
Mavg_Flow_tencent_GRAD_1_3<-5000 and Mavg_Flow_tencent_GRAD_1_3>=-10000,'Mavg_Flow_tencent_GRAD_1_3_负5_10',Mavg_Flow_tencent_GRAD_1_3<-10000 and Mavg_Flow_tencent_GRAD_1_3>=-20000,'Mavg_Flow_tencent_GRAD_1_3_负10_20',
Mavg_Flow_tencent_GRAD_1_3<-20000 ,'Mavg_Flow_tencent_GRAD_1_3_负20_p','xxx') as Mavg_Flow_tencent_GRAD_1_3_TYPE,
if(arrayReduce('avg',[Div_tencent_vFlux_1_3,DivAvg_tencent_vFlux_1_3])>1,1,arrayReduce('avg',[Div_tencent_vFlux_1_3,DivAvg_tencent_vFlux_1_3])) as Div_tencent_vFlux_1_3,
--
MAvg_Flow_tencent_2_4,
ifNull(MPer2_Flow_tencent,MAvg_Flow_tencent_2_4) as MPer2_Flow_tencent,
if(MAvg_Flow_tencent_2_4>20000,20000,MAvg_Flow_tencent_2_4)/20000 as MAvg_Flow_tencent_2_4_zs,
if(MPer2_Flow_tencent>20000,20000,MPer2_Flow_tencent)/20000 as MPer2_Flow_tencent_zs,

Mavg_Flow_tencent_GRAD_2_4,
multiIf(isNaN(Mavg_Flow_tencent_GRAD_2_4),'Mavg_Flow_tencent_GRAD_2_4_vNAN',Mavg_Flow_tencent_GRAD_2_4=0 ,'Mavg_Flow_tencent_GRAD_2_4_v0',
Mavg_Flow_tencent_GRAD_2_4>0 and Mavg_Flow_tencent_GRAD_2_4<=500,'Mavg_Flow_tencent_GRAD_2_4_正0_0.5',Mavg_Flow_tencent_GRAD_2_4>500 and Mavg_Flow_tencent_GRAD_2_4<=1000,'Mavg_Flow_tencent_GRAD_2_4_正0.5_1',
Mavg_Flow_tencent_GRAD_2_4>1000 and Mavg_Flow_tencent_GRAD_2_4<=2000,'Mavg_Flow_tencent_GRAD_2_4_正1_2',Mavg_Flow_tencent_GRAD_2_4>2000 and Mavg_Flow_tencent_GRAD_2_4<=5000,'Mavg_Flow_tencent_GRAD_2_4_正2_5',
Mavg_Flow_tencent_GRAD_2_4>5000 and Mavg_Flow_tencent_GRAD_2_4<=10000,'Mavg_Flow_tencent_GRAD_2_4_正5_10',Mavg_Flow_tencent_GRAD_2_4>10000 and Mavg_Flow_tencent_GRAD_2_4<=20000,'Mavg_Flow_tencent_GRAD_2_4_正10_20',
Mavg_Flow_tencent_GRAD_2_4>20000 ,'Mavg_Flow_tencent_GRAD_2_4_正20_p',
Mavg_Flow_tencent_GRAD_2_4<0 and Mavg_Flow_tencent_GRAD_2_4>=-500,'Mavg_Flow_tencent_GRAD_2_4_负0_0.5',Mavg_Flow_tencent_GRAD_2_4<-500 and Mavg_Flow_tencent_GRAD_2_4>=-1000,'Mavg_Flow_tencent_GRAD_2_4_负0.5_1',
Mavg_Flow_tencent_GRAD_2_4<-1000 and Mavg_Flow_tencent_GRAD_2_4>=-2000,'Mavg_Flow_tencent_GRAD_2_4_负1_2',Mavg_Flow_tencent_GRAD_2_4<-2000 and Mavg_Flow_tencent_GRAD_2_4>=-5000,'Mavg_Flow_tencent_GRAD_2_4_负2_5',
Mavg_Flow_tencent_GRAD_2_4<-5000 and Mavg_Flow_tencent_GRAD_2_4>=-10000,'Mavg_Flow_tencent_GRAD_2_4_负5_10',Mavg_Flow_tencent_GRAD_2_4<-10000 and Mavg_Flow_tencent_GRAD_2_4>=-20000,'Mavg_Flow_tencent_GRAD_2_4_负10_20',
Mavg_Flow_tencent_GRAD_2_4<-20000 ,'Mavg_Flow_tencent_GRAD_2_4_负20_p','xxx') as Mavg_Flow_tencent_GRAD_2_4_TYPE,
if(arrayReduce('avg',[Div_tencent_vFlux_2_4,DivAvg_tencent_vFlux_2_4])>1,1,arrayReduce('avg',[Div_tencent_vFlux_2_4,DivAvg_tencent_vFlux_2_4])) as Div_tencent_vFlux_2_4,
'+++哔哩+++' as cl4,
MAvg_Flow_bilibl_1_3,
ifNull(MPer1_Flow_bilibl,MAvg_Flow_bilibl_1_3) as MPer1_Flow_bilibl,
if(MAvg_Flow_bilibl_1_3>20000,20000,MAvg_Flow_bilibl_1_3)/20000 as MAvg_Flow_bilibl_1_3_zs,
if(MPer1_Flow_bilibl>20000,20000,MPer1_Flow_bilibl)/20000 as MPer1_Flow_bilibl_zs,
--分桶nan 0 500 1 2 5 10 +
Mavg_Flow_bilibl_GRAD_1_3,
multiIf(isNaN(Mavg_Flow_bilibl_GRAD_1_3),'Mavg_Flow_bilibl_GRAD_1_3_vNAN',Mavg_Flow_bilibl_GRAD_1_3=0 ,'Mavg_Flow_bilibl_GRAD_1_3_v0',
Mavg_Flow_bilibl_GRAD_1_3>0 and Mavg_Flow_bilibl_GRAD_1_3<=500,'Mavg_Flow_bilibl_GRAD_1_3_正0_0.5',Mavg_Flow_bilibl_GRAD_1_3>500 and Mavg_Flow_bilibl_GRAD_1_3<=1000,'Mavg_Flow_bilibl_GRAD_1_3_正0.5_1',
Mavg_Flow_bilibl_GRAD_1_3>1000 and Mavg_Flow_bilibl_GRAD_1_3<=2000,'Mavg_Flow_bilibl_GRAD_1_3_正1_2',Mavg_Flow_bilibl_GRAD_1_3>2000 and Mavg_Flow_bilibl_GRAD_1_3<=5000,'Mavg_Flow_bilibl_GRAD_1_3_正2_5',
Mavg_Flow_bilibl_GRAD_1_3>5000 and Mavg_Flow_bilibl_GRAD_1_3<=10000,'Mavg_Flow_bilibl_GRAD_1_3_正5_10',Mavg_Flow_bilibl_GRAD_1_3>10000 ,'Mavg_Flow_bilibl_GRAD_1_3_正10_p',
Mavg_Flow_bilibl_GRAD_1_3<0 and Mavg_Flow_bilibl_GRAD_1_3>=-500,'Mavg_Flow_bilibl_GRAD_1_3_负0_0.5',Mavg_Flow_bilibl_GRAD_1_3<-500 and Mavg_Flow_bilibl_GRAD_1_3>=-1000,'Mavg_Flow_bilibl_GRAD_1_3_负0.5_1',
Mavg_Flow_bilibl_GRAD_1_3<-1000 and Mavg_Flow_bilibl_GRAD_1_3>=-2000,'Mavg_Flow_bilibl_GRAD_1_3_负1_2',Mavg_Flow_bilibl_GRAD_1_3<-2000 and Mavg_Flow_bilibl_GRAD_1_3>=-5000,'Mavg_Flow_bilibl_GRAD_1_3_负2_5',
Mavg_Flow_bilibl_GRAD_1_3<-5000 and Mavg_Flow_bilibl_GRAD_1_3>=-10000,'Mavg_Flow_bilibl_GRAD_1_3_负5_10',Mavg_Flow_bilibl_GRAD_1_3<-10000 ,'Mavg_Flow_bilibl_GRAD_1_3_负10_p','xxx')
as Mavg_Flow_bilibl_GRAD_1_3_TYPE,
if(arrayReduce('avg',[Div_bilibl_vFlux_1_3,DivAvg_bilibl_vFlux_1_3])>1,1,arrayReduce('avg',[Div_bilibl_vFlux_1_3,DivAvg_bilibl_vFlux_1_3])) as Div_bilibl_vFlux_1_3,

MAvg_Flow_bilibl_2_4,
ifNull(MPer2_Flow_bilibl,MAvg_Flow_bilibl_2_4) as MPer2_Flow_bilibl,
if(MAvg_Flow_bilibl_2_4>20000,20000,MAvg_Flow_bilibl_2_4)/20000 as MAvg_Flow_bilibl_2_4_zs,
if(MPer2_Flow_bilibl>20000,20000,MPer2_Flow_bilibl)/20000 as MPer2_Flow_bilibl_zs,
--
Mavg_Flow_bilibl_GRAD_2_4,
multiIf(isNaN(Mavg_Flow_bilibl_GRAD_2_4),'Mavg_Flow_bilibl_GRAD_2_4_vNAN',Mavg_Flow_bilibl_GRAD_2_4=0 ,'Mavg_Flow_bilibl_GRAD_2_4_v0',
Mavg_Flow_bilibl_GRAD_2_4>0 and Mavg_Flow_bilibl_GRAD_2_4<=500,'Mavg_Flow_bilibl_GRAD_2_4_正0_0.5',Mavg_Flow_bilibl_GRAD_2_4>500 and Mavg_Flow_bilibl_GRAD_2_4<=1000,'Mavg_Flow_bilibl_GRAD_2_4_正0.5_1',
Mavg_Flow_bilibl_GRAD_2_4>1000 and Mavg_Flow_bilibl_GRAD_2_4<=2000,'Mavg_Flow_bilibl_GRAD_2_4_正1_2',Mavg_Flow_bilibl_GRAD_2_4>2000 and Mavg_Flow_bilibl_GRAD_2_4<=5000,'Mavg_Flow_bilibl_GRAD_2_4_正2_5',
Mavg_Flow_bilibl_GRAD_2_4>5000 and Mavg_Flow_bilibl_GRAD_2_4<=10000,'Mavg_Flow_bilibl_GRAD_2_4_正5_10',Mavg_Flow_bilibl_GRAD_2_4>10000 ,'Mavg_Flow_bilibl_GRAD_2_4_正10_p',
Mavg_Flow_bilibl_GRAD_2_4<0 and Mavg_Flow_bilibl_GRAD_2_4>=-500,'Mavg_Flow_bilibl_GRAD_2_4_负0_0.5',Mavg_Flow_bilibl_GRAD_2_4<-500 and Mavg_Flow_bilibl_GRAD_2_4>=-1000,'Mavg_Flow_bilibl_GRAD_2_4_负0.5_1',
Mavg_Flow_bilibl_GRAD_2_4<-1000 and Mavg_Flow_bilibl_GRAD_2_4>=-2000,'Mavg_Flow_bilibl_GRAD_2_4_负1_2',Mavg_Flow_bilibl_GRAD_2_4<-2000 and Mavg_Flow_bilibl_GRAD_2_4>=-5000,'Mavg_Flow_bilibl_GRAD_2_4_负2_5',
Mavg_Flow_bilibl_GRAD_2_4<-5000 and Mavg_Flow_bilibl_GRAD_2_4>=-10000,'Mavg_Flow_bilibl_GRAD_2_4_负5_10',Mavg_Flow_bilibl_GRAD_2_4<-10000 ,'Mavg_Flow_bilibl_GRAD_2_4_负10_p','xxx')
as Mavg_Flow_bilibl_GRAD_2_4_TYPE,
if(arrayReduce('avg',[Div_bilibl_vFlux_2_4,DivAvg_bilibl_vFlux_2_4])>1,1,arrayReduce('avg',[Div_bilibl_vFlux_2_4,DivAvg_bilibl_vFlux_2_4])) as Div_bilibl_vFlux_2_4,
'+++爱奇艺+++' as cl5,
MAvg_Flow_aiqy_1_3,
ifNull(MPer1_Flow_aiqy,MAvg_Flow_aiqy_1_3) as MPer1_Flow_aiqy,
if(MAvg_Flow_aiqy_1_3>20000,20000,MAvg_Flow_aiqy_1_3)/20000 as MAvg_Flow_aiqy_1_3_zs,
if(MPer1_Flow_aiqy>20000,20000,MPer1_Flow_aiqy)/20000 as MPer1_Flow_aiqy_zs,
--分桶nan 0 500 1 2 5 10 +
Mavg_Flow_aiqy_GRAD_1_3,
multiIf(isNaN(Mavg_Flow_aiqy_GRAD_1_3),'Mavg_Flow_aiqy_GRAD_1_3_vNAN',Mavg_Flow_aiqy_GRAD_1_3=0 ,'Mavg_Flow_aiqy_GRAD_1_3_v0',
Mavg_Flow_aiqy_GRAD_1_3>0 and Mavg_Flow_aiqy_GRAD_1_3<=500,'Mavg_Flow_aiqy_GRAD_1_3_正0_0.5',Mavg_Flow_aiqy_GRAD_1_3>500 and Mavg_Flow_aiqy_GRAD_1_3<=1000,'Mavg_Flow_aiqy_GRAD_1_3_正0.5_1',
Mavg_Flow_aiqy_GRAD_1_3>1000 and Mavg_Flow_aiqy_GRAD_1_3<=2000,'Mavg_Flow_aiqy_GRAD_1_3_正1_2',Mavg_Flow_aiqy_GRAD_1_3>2000 and Mavg_Flow_aiqy_GRAD_1_3<=5000,'Mavg_Flow_aiqy_GRAD_1_3_正2_5',
Mavg_Flow_aiqy_GRAD_1_3>5000 and Mavg_Flow_aiqy_GRAD_1_3<=10000,'Mavg_Flow_aiqy_GRAD_1_3_正5_10',Mavg_Flow_aiqy_GRAD_1_3>10000 ,'Mavg_Flow_aiqy_GRAD_1_3_正10_p',
Mavg_Flow_aiqy_GRAD_1_3<0 and Mavg_Flow_aiqy_GRAD_1_3>=-500,'Mavg_Flow_aiqy_GRAD_1_3_负0_0.5',Mavg_Flow_aiqy_GRAD_1_3<-500 and Mavg_Flow_aiqy_GRAD_1_3>=-1000,'Mavg_Flow_aiqy_GRAD_1_3_负0.5_1',
Mavg_Flow_aiqy_GRAD_1_3<-1000 and Mavg_Flow_aiqy_GRAD_1_3>=-2000,'Mavg_Flow_aiqy_GRAD_1_3_负1_2',Mavg_Flow_aiqy_GRAD_1_3<-2000 and Mavg_Flow_aiqy_GRAD_1_3>=-5000,'Mavg_Flow_aiqy_GRAD_1_3_负2_5',
Mavg_Flow_aiqy_GRAD_1_3<-5000 and Mavg_Flow_aiqy_GRAD_1_3>=-10000,'Mavg_Flow_aiqy_GRAD_1_3_负5_10',Mavg_Flow_aiqy_GRAD_1_3<-10000 ,'Mavg_Flow_aiqy_GRAD_1_3_负10_p','xxx')
as Mavg_Flow_aiqy_GRAD_1_3_TYPE,
if(arrayReduce('avg',[Div_aiqy_vFlux_1_3,DivAvg_aiqy_vFlux_1_3])>1,1,arrayReduce('avg',[Div_aiqy_vFlux_1_3,DivAvg_aiqy_vFlux_1_3])) as Div_aiqy_vFlux_1_3,
MAvg_Flow_aiqy_2_4,
ifNull(MPer2_Flow_aiqy,MAvg_Flow_aiqy_2_4) as MPer2_Flow_aiqy,
if(MAvg_Flow_aiqy_2_4>20000,20000,MAvg_Flow_aiqy_2_4)/20000 as MAvg_Flow_aiqy_2_4_zs,
if(MPer2_Flow_aiqy>20000,20000,MPer2_Flow_aiqy)/20000 as MPer2_Flow_aiqy_zs,
--
Mavg_Flow_aiqy_GRAD_2_4,
multiIf(isNaN(Mavg_Flow_aiqy_GRAD_2_4),'Mavg_Flow_aiqy_GRAD_2_4_vNAN',Mavg_Flow_aiqy_GRAD_2_4=0 ,'Mavg_Flow_aiqy_GRAD_2_4_v0',
Mavg_Flow_aiqy_GRAD_2_4>0 and Mavg_Flow_aiqy_GRAD_2_4<=500,'Mavg_Flow_aiqy_GRAD_2_4_正0_0.5',Mavg_Flow_aiqy_GRAD_2_4>500 and Mavg_Flow_aiqy_GRAD_2_4<=1000,'Mavg_Flow_aiqy_GRAD_2_4_正0.5_1',
Mavg_Flow_aiqy_GRAD_2_4>1000 and Mavg_Flow_aiqy_GRAD_2_4<=2000,'Mavg_Flow_aiqy_GRAD_2_4_正1_2',Mavg_Flow_aiqy_GRAD_2_4>2000 and Mavg_Flow_aiqy_GRAD_2_4<=5000,'Mavg_Flow_aiqy_GRAD_2_4_正2_5',
Mavg_Flow_aiqy_GRAD_2_4>5000 and Mavg_Flow_aiqy_GRAD_2_4<=10000,'Mavg_Flow_aiqy_GRAD_2_4_正5_10',Mavg_Flow_aiqy_GRAD_2_4>10000 ,'Mavg_Flow_aiqy_GRAD_2_4_正10_p',
Mavg_Flow_aiqy_GRAD_2_4<0 and Mavg_Flow_aiqy_GRAD_2_4>=-500,'Mavg_Flow_aiqy_GRAD_2_4_负0_0.5',Mavg_Flow_aiqy_GRAD_2_4<-500 and Mavg_Flow_aiqy_GRAD_2_4>=-1000,'Mavg_Flow_aiqy_GRAD_2_4_负0.5_1',
Mavg_Flow_aiqy_GRAD_2_4<-1000 and Mavg_Flow_aiqy_GRAD_2_4>=-2000,'Mavg_Flow_aiqy_GRAD_2_4_负1_2',Mavg_Flow_aiqy_GRAD_2_4<-2000 and Mavg_Flow_aiqy_GRAD_2_4>=-5000,'Mavg_Flow_aiqy_GRAD_2_4_负2_5',
Mavg_Flow_aiqy_GRAD_2_4<-5000 and Mavg_Flow_aiqy_GRAD_2_4>=-10000,'Mavg_Flow_aiqy_GRAD_2_4_负5_10',Mavg_Flow_aiqy_GRAD_2_4<-10000 ,'Mavg_Flow_aiqy_GRAD_2_4_负10_p','xxx')
as Mavg_Flow_aiqy_GRAD_2_4_TYPE,
if(arrayReduce('avg',[Div_aiqy_vFlux_2_4,DivAvg_aiqy_vFlux_2_4])>1,1,arrayReduce('avg',[Div_aiqy_vFlux_2_4,DivAvg_aiqy_vFlux_2_4])) as Div_aiqy_vFlux_2_4,
'+++优酷+++' as cl6,
MAvg_Flow_youtu_1_3,
ifNull(MPer1_Flow_youtu,MAvg_Flow_youtu_1_3) as MPer1_Flow_youtu,
if(MAvg_Flow_youtu_1_3>20000,20000,MAvg_Flow_youtu_1_3)/20000 as MAvg_Flow_youtu_1_3_zs,
if(MPer1_Flow_youtu>20000,20000,MPer1_Flow_youtu)/20000 as MPer1_Flow_youtu_zs,
--分桶nan 0 500 1 2 5 10 +
Mavg_Flow_youtu_GRAD_1_3,
multiIf(isNaN(Mavg_Flow_youtu_GRAD_1_3),'Mavg_Flow_youtu_GRAD_1_3_vNAN',Mavg_Flow_youtu_GRAD_1_3=0 ,'Mavg_Flow_youtu_GRAD_1_3_v0',
Mavg_Flow_youtu_GRAD_1_3>0 and Mavg_Flow_youtu_GRAD_1_3<=500,'Mavg_Flow_youtu_GRAD_1_3_正0_0.5',Mavg_Flow_youtu_GRAD_1_3>500 and Mavg_Flow_youtu_GRAD_1_3<=1000,'Mavg_Flow_youtu_GRAD_1_3_正0.5_1',
Mavg_Flow_youtu_GRAD_1_3>1000 and Mavg_Flow_youtu_GRAD_1_3<=2000,'Mavg_Flow_youtu_GRAD_1_3_正1_2',Mavg_Flow_youtu_GRAD_1_3>2000 and Mavg_Flow_youtu_GRAD_1_3<=5000,'Mavg_Flow_youtu_GRAD_1_3_正2_5',
Mavg_Flow_youtu_GRAD_1_3>5000 and Mavg_Flow_youtu_GRAD_1_3<=10000,'Mavg_Flow_youtu_GRAD_1_3_正5_10',Mavg_Flow_youtu_GRAD_1_3>10000 ,'Mavg_Flow_youtu_GRAD_1_3_正10_p',
Mavg_Flow_youtu_GRAD_1_3<0 and Mavg_Flow_youtu_GRAD_1_3>=-500,'Mavg_Flow_youtu_GRAD_1_3_负0_0.5',Mavg_Flow_youtu_GRAD_1_3<-500 and Mavg_Flow_youtu_GRAD_1_3>=-1000,'Mavg_Flow_youtu_GRAD_1_3_负0.5_1',
Mavg_Flow_youtu_GRAD_1_3<-1000 and Mavg_Flow_youtu_GRAD_1_3>=-2000,'Mavg_Flow_youtu_GRAD_1_3_负1_2',Mavg_Flow_youtu_GRAD_1_3<-2000 and Mavg_Flow_youtu_GRAD_1_3>=-5000,'Mavg_Flow_youtu_GRAD_1_3_负2_5',
Mavg_Flow_youtu_GRAD_1_3<-5000 and Mavg_Flow_youtu_GRAD_1_3>=-10000,'Mavg_Flow_youtu_GRAD_1_3_负5_10',Mavg_Flow_youtu_GRAD_1_3<-10000 ,'Mavg_Flow_youtu_GRAD_1_3_负10_p','xxx')
as Mavg_Flow_youtu_GRAD_1_3_TYPE,
if(arrayReduce('avg',[Div_youtu_vFlux_1_3,DivAvg_youtu_vFlux_1_3])>1,1,arrayReduce('avg',[Div_youtu_vFlux_1_3,DivAvg_youtu_vFlux_1_3])) as Div_youtu_vFlux_1_3,

MAvg_Flow_youtu_2_4,
ifNull(MPer2_Flow_youtu,MAvg_Flow_youtu_2_4) as MPer2_Flow_youtu,
if(MAvg_Flow_youtu_2_4>20000,20000,MAvg_Flow_youtu_2_4)/20000 as MAvg_Flow_youtu_2_4_zs,
if(MPer2_Flow_youtu>20000,20000,MPer2_Flow_youtu)/20000 as MPer2_Flow_youtu_zs,
--
Mavg_Flow_youtu_GRAD_2_4,
multiIf(isNaN(Mavg_Flow_youtu_GRAD_2_4),'Mavg_Flow_youtu_GRAD_2_4_vNAN',Mavg_Flow_youtu_GRAD_2_4=0 ,'Mavg_Flow_youtu_GRAD_2_4_v0',
Mavg_Flow_youtu_GRAD_2_4>0 and Mavg_Flow_youtu_GRAD_2_4<=500,'Mavg_Flow_youtu_GRAD_2_4_正0_0.5',Mavg_Flow_youtu_GRAD_2_4>500 and Mavg_Flow_youtu_GRAD_2_4<=1000,'Mavg_Flow_youtu_GRAD_2_4_正0.5_1',
Mavg_Flow_youtu_GRAD_2_4>1000 and Mavg_Flow_youtu_GRAD_2_4<=2000,'Mavg_Flow_youtu_GRAD_2_4_正1_2',Mavg_Flow_youtu_GRAD_2_4>2000 and Mavg_Flow_youtu_GRAD_2_4<=5000,'Mavg_Flow_youtu_GRAD_2_4_正2_5',
Mavg_Flow_youtu_GRAD_2_4>5000 and Mavg_Flow_youtu_GRAD_2_4<=10000,'Mavg_Flow_youtu_GRAD_2_4_正5_10',Mavg_Flow_youtu_GRAD_2_4>10000 ,'Mavg_Flow_youtu_GRAD_2_4_正10_p',
Mavg_Flow_youtu_GRAD_2_4<0 and Mavg_Flow_youtu_GRAD_2_4>=-500,'Mavg_Flow_youtu_GRAD_2_4_负0_0.5',Mavg_Flow_youtu_GRAD_2_4<-500 and Mavg_Flow_youtu_GRAD_2_4>=-1000,'Mavg_Flow_youtu_GRAD_2_4_负0.5_1',
Mavg_Flow_youtu_GRAD_2_4<-1000 and Mavg_Flow_youtu_GRAD_2_4>=-2000,'Mavg_Flow_youtu_GRAD_2_4_负1_2',Mavg_Flow_youtu_GRAD_2_4<-2000 and Mavg_Flow_youtu_GRAD_2_4>=-5000,'Mavg_Flow_youtu_GRAD_2_4_负2_5',
Mavg_Flow_youtu_GRAD_2_4<-5000 and Mavg_Flow_youtu_GRAD_2_4>=-10000,'Mavg_Flow_youtu_GRAD_2_4_负5_10',Mavg_Flow_youtu_GRAD_2_4<-10000 ,'Mavg_Flow_youtu_GRAD_2_4_负10_p','xxx')
as Mavg_Flow_youtu_GRAD_2_4_TYPE,
if(arrayReduce('avg',[Div_youtu_vFlux_2_4,DivAvg_youtu_vFlux_2_4])>1,1,arrayReduce('avg',[Div_youtu_vFlux_2_4,DivAvg_youtu_vFlux_2_4])) as Div_youtu_vFlux_2_4,

IS_CANCEL
from
(
select TARGET_MONTH,
USERID,PRICE/48 as PRICE,if(MAXFLOW>50000,50000,MAXFLOW)/50000 as MAXFLOW,
if(TOTAL_FEE_AVG>300,300,TOTAL_FEE_AVG)/300 as TOTAL_FEE_AVG,IS_ACCT_AVG,
--if(TOTAL_FLUX_AVG>20000,20000,TOTAL_FLUX_AVG)/20000 as TOTAL_FLUX_AVG,
--if(TOTAL_FLUX_VIDEO_AVG>20000,20000,TOTAL_FLUX_VIDEO_AVG)/20000 as TOTAL_FLUX_VIDEO_AVG,
PROVINCE,
if(c1.CODE='','其他',c1.CODE) as CHANNEL,
if(cp.CODE='','其他',cp.CODE) as CPID,
if(sp.CODE='','其他',sp.CODE) as SPID,
DIFF_MONYH_TYPE,CUST_SEX,CERT_AGE,MANU_NAME,
BELONGTO,CPTYPE,IS_VIP,`MPer1_Flow`, MAvg3_Flow,M1_Flow02,
toInt32OrNull(PACKAGE_PRICE) as pprice,
multiIf(pprice is NULL,'pkgPic_null',pprice<=10 ,'pkgPic_0_10',pprice>10 and pprice<=20,'pkgPic_10_20',pprice>20 and pprice<=40,'pkgPic_20_40',
pprice>40 and pprice<=60,'pkgPic_40_60',pprice>60 and pprice<=80,'pkgPic_60_80',pprice>80 and pprice<=100,'pkgPic_80_100',
pprice>100 and pprice<=150,'pkgPic_100_150',pprice>150 and pprice<=300,'pkgPic_150_300',pprice>300,'pkgPic_300_p','pkgPic_xxx') as PACKAGE_PRICE_TYPE,

multiIf(H_FLUX is NULL,'hflux_null',H_FLUX=0,'hflux_0',H_FLUX>0 and H_FLUX<=5,'hflux_0_5',H_FLUX>5 and H_FLUX<=10,'hflux_5_10',
H_FLUX>10 and H_FLUX<=20,'hflux_10_20',H_FLUX>20 and H_FLUX<=40,'hflux_20_40',H_FLUX>40 and H_FLUX<=60,'hflux_40_60',
H_FLUX>60,'hflux_60_p','hflux_xxx') as H_FLUX_TYPE,IS_DAWANG,
MPer1_TOTAL_FLUX,MPer2_TOTAL_FLUX,MPer3_TOTAL_FLUX,MPer4_TOTAL_FLUX,
MPer1_TOTAL_VIDEO_FLUX,MPer2_TOTAL_VIDEO_FLUX,MPer3_TOTAL_VIDEO_FLUX,MPer4_TOTAL_VIDEO_FLUX,

[MPer3_TOTAL_FLUX,MPer2_TOTAL_FLUX,MPer1_TOTAL_FLUX] as TOTAL_FLUX_1_3,
arrayReduce('avg', TOTAL_FLUX_1_3) MAvg_TOTAL_FLUX_1_3,
arrayFilter(x -> x> 0 ,[ifNull(MPer3_TOTAL_FLUX,-1),ifNull(MPer2_TOTAL_FLUX,-1),ifNull(MPer1_TOTAL_FLUX,-1)]) as TOTAL_FLUX_1_3_notNull,
arrayReduce('avg',arrayFilter(x-> x!=0 ,arrayDifference(TOTAL_FLUX_1_3_notNull))) as Mavg_TOTAL_FLUX_GRAD_1_3, --近1-3月有数值情况下 流量变化趋势（平均）

[MPer4_TOTAL_FLUX,MPer3_TOTAL_FLUX,MPer2_TOTAL_FLUX] as TOTAL_FLUX_2_4,
arrayReduce('avg', TOTAL_FLUX_2_4) MAvg_TOTAL_FLUX_2_4,
arrayFilter(x -> x> 0 ,[ifNull(MPer4_TOTAL_FLUX,-1),ifNull(MPer3_TOTAL_FLUX,-1),ifNull(MPer2_TOTAL_FLUX,-1)]) as TOTAL_FLUX_2_4_notNull,
arrayReduce('avg',arrayFilter(x-> x!=0 ,arrayDifference(TOTAL_FLUX_2_4_notNull))) as Mavg_TOTAL_FLUX_GRAD_2_4, --近2-4月有数值情况下 流量变化趋势（平均）

[MPer3_TOTAL_VIDEO_FLUX,MPer2_TOTAL_VIDEO_FLUX,MPer1_TOTAL_VIDEO_FLUX] as TOTAL_VIDEO_FLUX_1_3,
arrayReduce('avg', TOTAL_VIDEO_FLUX_1_3) MAvg_TOTAL_VIDEO_FLUX_1_3,
arrayFilter(x -> x> 0 ,[ifNull(MPer3_TOTAL_VIDEO_FLUX,-1),ifNull(MPer2_TOTAL_VIDEO_FLUX,-1),ifNull(MPer1_TOTAL_VIDEO_FLUX,-1)]) as TOTAL_VIDEO_FLUX_1_3_notNull,
arrayReduce('avg',arrayFilter(x-> x!=0 ,arrayDifference(TOTAL_VIDEO_FLUX_1_3_notNull))) as Mavg_TOTAL_VIDEO_FLUX_GRAD_1_3, --近1-3月有数值情况下 视频流量变化趋势（平均）

[MPer4_TOTAL_VIDEO_FLUX,MPer3_TOTAL_VIDEO_FLUX,MPer2_TOTAL_VIDEO_FLUX] as TOTAL_VIDEO_FLUX_2_4,
arrayReduce('avg', TOTAL_VIDEO_FLUX_2_4) MAvg_TOTAL_VIDEO_FLUX_2_4,
arrayFilter(x -> x> 0 ,[ifNull(MPer4_TOTAL_VIDEO_FLUX,-1),ifNull(MPer3_TOTAL_VIDEO_FLUX,-1),ifNull(MPer2_TOTAL_VIDEO_FLUX,-1)]) as TOTAL_VIDEO_FLUX_2_4_notNull,
arrayReduce('avg',arrayFilter(x-> x!=0 ,arrayDifference(TOTAL_VIDEO_FLUX_2_4_notNull))) as Mavg_TOTAL_VIDEO_FLUX_GRAD_2_4, --近2-4月有数值情况下 视频流量变化趋势（平均）

(MPer1_TOTAL_VIDEO_FLUX/MPer1_TOTAL_FLUX) as Div_vFlux_tFlux_1_3,-- 前1月视频流量占总流量比值
(MAvg_TOTAL_VIDEO_FLUX_1_3/MAvg_TOTAL_FLUX_1_3) as DivAvg_vFlux_tFlux_1_3,-- 近1-3月视频流量占总流量比值
(MPer2_TOTAL_VIDEO_FLUX/MPer2_TOTAL_FLUX) as Div_vFlux_tFlux_2_4,-- 前2月视频流量占总流量比值
(MAvg_TOTAL_VIDEO_FLUX_2_4/MAvg_TOTAL_FLUX_2_4) as DivAvg_vFlux_tFlux_2_4,-- 前近2-4月视频流量占总流量比值

'+++++',
--kuaishou
MPer4_Flow_kuaishou,MPer3_Flow_kuaishou,MPer2_Flow_kuaishou,MPer1_Flow_kuaishou,
[MPer3_Flow_kuaishou,MPer2_Flow_kuaishou,MPer1_Flow_kuaishou] as Flow_kuaishou_1_3,
arrayReduce('avg', Flow_kuaishou_1_3) MAvg_Flow_kuaishou_1_3,
arrayFilter(x -> x> 0 ,[ifNull(MPer3_Flow_kuaishou,-1),ifNull(MPer2_Flow_kuaishou,-1),ifNull(MPer1_Flow_kuaishou,-1)]) as Flow_kuaishou_1_3_notNull,
arrayReduce('avg',arrayFilter(x-> x!=0 ,arrayDifference(Flow_kuaishou_1_3_notNull))) as Mavg_Flow_kuaishou_GRAD_1_3,

[MPer4_Flow_kuaishou,MPer3_Flow_kuaishou,MPer2_Flow_kuaishou] as Flow_kuaishou_2_4,
arrayReduce('avg', Flow_kuaishou_2_4) MAvg_Flow_kuaishou_2_4,
arrayFilter(x -> x> 0 ,[ifNull(MPer4_Flow_kuaishou,-1),ifNull(MPer3_Flow_kuaishou,-1),ifNull(MPer2_Flow_kuaishou,-1)]) as Flow_kuaishou_2_4_notNull,
arrayReduce('avg',arrayFilter(x-> x!=0 ,arrayDifference(Flow_kuaishou_2_4_notNull))) as Mavg_Flow_kuaishou_GRAD_2_4,
(MPer1_Flow_kuaishou/MPer1_TOTAL_VIDEO_FLUX) as Div_kuaishou_vFlux_1_3,
(MAvg_Flow_kuaishou_1_3/MAvg_TOTAL_VIDEO_FLUX_1_3) as DivAvg_kuaishou_vFlux_1_3,
(MPer2_Flow_kuaishou/MPer2_TOTAL_VIDEO_FLUX) as Div_kuaishou_vFlux_2_4,
(MAvg_Flow_kuaishou_2_4/MAvg_TOTAL_VIDEO_FLUX_2_4) as DivAvg_kuaishou_vFlux_2_4,
--tencent
MPer1_Flow_tencent,MPer2_Flow_tencent,MPer3_Flow_tencent,MPer4_Flow_tencent,
[MPer3_Flow_tencent,MPer2_Flow_tencent,MPer1_Flow_tencent] as Flow_tencent_1_3,
arrayReduce('avg', Flow_tencent_1_3) MAvg_Flow_tencent_1_3,
arrayFilter(x -> x> 0 ,[ifNull(MPer3_Flow_tencent,-1),ifNull(MPer2_Flow_tencent,-1),ifNull(MPer1_Flow_tencent,-1)]) as Flow_tencent_1_3_notNull,
arrayReduce('avg',arrayFilter(x-> x!=0 ,arrayDifference(Flow_tencent_1_3_notNull))) as Mavg_Flow_tencent_GRAD_1_3,

[MPer4_Flow_tencent,MPer3_Flow_tencent,MPer2_Flow_tencent] as Flow_tencent_2_4,
arrayReduce('avg', Flow_tencent_2_4) MAvg_Flow_tencent_2_4,
arrayFilter(x -> x> 0 ,[ifNull(MPer4_Flow_tencent,-1),ifNull(MPer3_Flow_tencent,-1),ifNull(MPer2_Flow_tencent,-1)]) as Flow_tencent_2_4_notNull,
arrayReduce('avg',arrayFilter(x-> x!=0 ,arrayDifference(Flow_tencent_2_4_notNull))) as Mavg_Flow_tencent_GRAD_2_4,
(MPer1_Flow_tencent/MPer1_TOTAL_VIDEO_FLUX) as Div_tencent_vFlux_1_3,
(MAvg_Flow_tencent_1_3/MAvg_TOTAL_VIDEO_FLUX_1_3) as DivAvg_tencent_vFlux_1_3,
(MPer2_Flow_tencent/MPer2_TOTAL_VIDEO_FLUX) as Div_tencent_vFlux_2_4,
(MAvg_Flow_tencent_2_4/MAvg_TOTAL_VIDEO_FLUX_2_4) as DivAvg_tencent_vFlux_2_4,
--bilibl
MPer4_Flow_bilibl,MPer3_Flow_bilibl,MPer2_Flow_bilibl,MPer1_Flow_bilibl,
[MPer3_Flow_bilibl,MPer2_Flow_bilibl,MPer1_Flow_bilibl] as Flow_bilibl_1_3,
arrayReduce('avg', Flow_bilibl_1_3) MAvg_Flow_bilibl_1_3,
arrayFilter(x -> x> 0 ,[ifNull(MPer3_Flow_bilibl,-1),ifNull(MPer2_Flow_bilibl,-1),ifNull(MPer1_Flow_bilibl,-1)]) as Flow_bilibl_1_3_notNull,
arrayReduce('avg',arrayFilter(x-> x!=0 ,arrayDifference(Flow_bilibl_1_3_notNull))) as Mavg_Flow_bilibl_GRAD_1_3,

[MPer4_Flow_bilibl,MPer3_Flow_bilibl,MPer2_Flow_bilibl] as Flow_bilibl_2_4,
arrayReduce('avg', Flow_bilibl_2_4) MAvg_Flow_bilibl_2_4,
arrayFilter(x -> x> 0 ,[ifNull(MPer4_Flow_bilibl,-1),ifNull(MPer3_Flow_bilibl,-1),ifNull(MPer2_Flow_bilibl,-1)]) as Flow_bilibl_2_4_notNull,
arrayReduce('avg',arrayFilter(x-> x!=0 ,arrayDifference(Flow_bilibl_2_4_notNull))) as Mavg_Flow_bilibl_GRAD_2_4,
(MPer1_Flow_bilibl/MPer1_TOTAL_VIDEO_FLUX) as Div_bilibl_vFlux_1_3,
(MAvg_Flow_bilibl_1_3/MAvg_TOTAL_VIDEO_FLUX_1_3) as DivAvg_bilibl_vFlux_1_3,
(MPer2_Flow_bilibl/MPer2_TOTAL_VIDEO_FLUX) as Div_bilibl_vFlux_2_4,
(MAvg_Flow_bilibl_2_4/MAvg_TOTAL_VIDEO_FLUX_2_4) as DivAvg_bilibl_vFlux_2_4,
--aiqy
MPer4_Flow_aiqy,MPer3_Flow_aiqy,MPer2_Flow_aiqy,MPer1_Flow_aiqy,
[MPer3_Flow_aiqy,MPer2_Flow_aiqy,MPer1_Flow_aiqy] as Flow_aiqy_1_3,
arrayReduce('avg', Flow_aiqy_1_3) MAvg_Flow_aiqy_1_3,
arrayFilter(x -> x> 0 ,[ifNull(MPer3_Flow_aiqy,-1),ifNull(MPer2_Flow_aiqy,-1),ifNull(MPer1_Flow_aiqy,-1)]) as Flow_aiqy_1_3_notNull,
arrayReduce('avg',arrayFilter(x-> x!=0 ,arrayDifference(Flow_aiqy_1_3_notNull))) as Mavg_Flow_aiqy_GRAD_1_3,

[MPer4_Flow_aiqy,MPer3_Flow_aiqy,MPer2_Flow_aiqy] as Flow_aiqy_2_4,
arrayReduce('avg', Flow_aiqy_2_4) MAvg_Flow_aiqy_2_4,
arrayFilter(x -> x> 0 ,[ifNull(MPer4_Flow_aiqy,-1),ifNull(MPer3_Flow_aiqy,-1),ifNull(MPer2_Flow_aiqy,-1)]) as Flow_aiqy_2_4_notNull,
arrayReduce('avg',arrayFilter(x-> x!=0 ,arrayDifference(Flow_aiqy_2_4_notNull))) as Mavg_Flow_aiqy_GRAD_2_4,
(MPer1_Flow_aiqy/MPer1_TOTAL_VIDEO_FLUX) as Div_aiqy_vFlux_1_3,
(MAvg_Flow_aiqy_1_3/MAvg_TOTAL_VIDEO_FLUX_1_3) as DivAvg_aiqy_vFlux_1_3,
(MPer2_Flow_aiqy/MPer2_TOTAL_VIDEO_FLUX) as Div_aiqy_vFlux_2_4,
(MAvg_Flow_aiqy_2_4/MAvg_TOTAL_VIDEO_FLUX_2_4) as DivAvg_aiqy_vFlux_2_4,
--youtu
MPer4_Flow_youtu,MPer3_Flow_youtu,MPer2_Flow_youtu,MPer1_Flow_youtu,
[MPer3_Flow_youtu,MPer2_Flow_youtu,MPer1_Flow_youtu] as Flow_youtu_1_3,
arrayReduce('avg', Flow_youtu_1_3) MAvg_Flow_youtu_1_3,
arrayFilter(x -> x> 0 ,[ifNull(MPer3_Flow_youtu,-1),ifNull(MPer2_Flow_youtu,-1),ifNull(MPer1_Flow_youtu,-1)]) as Flow_youtu_1_3_notNull,
arrayReduce('avg',arrayFilter(x-> x!=0 ,arrayDifference(Flow_youtu_1_3_notNull))) as Mavg_Flow_youtu_GRAD_1_3,

[MPer4_Flow_youtu,MPer3_Flow_youtu,MPer2_Flow_youtu] as Flow_youtu_2_4,
arrayReduce('avg', Flow_youtu_2_4) MAvg_Flow_youtu_2_4,
arrayFilter(x -> x> 0 ,[ifNull(MPer4_Flow_youtu,-1),ifNull(MPer3_Flow_youtu,-1),ifNull(MPer2_Flow_youtu,-1)]) as Flow_youtu_2_4_notNull,
arrayReduce('avg',arrayFilter(x-> x!=0 ,arrayDifference(Flow_youtu_2_4_notNull))) as Mavg_Flow_youtu_GRAD_2_4,
(MPer1_Flow_youtu/MPer1_TOTAL_VIDEO_FLUX) as Div_youtu_vFlux_1_3,
(MAvg_Flow_youtu_1_3/MAvg_TOTAL_VIDEO_FLUX_1_3) as DivAvg_youtu_vFlux_1_3,
(MPer2_Flow_youtu/MPer2_TOTAL_VIDEO_FLUX) as Div_youtu_vFlux_2_4,
(MAvg_Flow_youtu_2_4/MAvg_TOTAL_VIDEO_FLUX_2_4) as DivAvg_youtu_vFlux_2_4,
IS_CANCEL
from ads.ALS_XXH_CANCEL_NEW_C4 c
left join (select * from ALS_XXH_CANCEL_NEW_C3_lowDim_dic where `TYPE`='CHANNEL') as c1 on c.CHANNEL =c1.CODE
left join (select * from ALS_XXH_CANCEL_NEW_C3_lowDim_dic where `TYPE`='CPID') as cp on c.CPID =cp.CODE
left join (select * from ALS_XXH_CANCEL_NEW_C3_lowDim_dic where `TYPE`='SPID') as sp on c.SPID =sp.CODE
where c.TARGET_MONTH ='${month}'
)