select UNITNAME,WRITER,PHONE,Real_Person_Num,
(if(MPOSTS is null,0,MPOSTS)+if(TPOSTS is null,0,TPOSTS)+if(WPOSTS is null,0,WPOSTS)) as TOTAL_POSTS,
M_Persont,T_Persont,L_Persont,
ML3,ML4,ML5,ML6,ML7,ML8,ML9,ML10,
HL,ML,LL,
TL2,TL3,TL4,TL5,TL6,TL7,TL8,TL9,TL10,TL11,TL12,TL13,
LL3,LL4,LL5,LL14,
cast(MRATIO as char) as MYMRATIO,cast(TRATIO as char) as
MYTRATIO,cast(WRATIO as char) as MYWRATIO,
MPOSTS,TPOSTS,WPOSTS,
if(cast(round(ROUND(ML3/if(MPOSTS=0,1,MPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as mbl3,
if(cast(round(ROUND(ML4/if(MPOSTS=0,1,MPOSTS),4)*100,1) as
char)=\"0.0\
as char),\"%\")) as mbl4,
if(cast(round(ROUND(ML5/if(MPOSTS=0,1,MPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as mbl5,
if(cast(round(ROUND(ML6/if(MPOSTS=0,1,MPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as mbl6,
if(cast(round(ROUND(ML7/if(MPOSTS=0,1,MPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as mbl7,
if(cast(round(ROUND(ML8/if(MPOSTS=0,1,MPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as mbl8,
if(cast(round(ROUND(ML9/if(MPOSTS=0,1,MPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as mbl9,
if(cast(round(ROUND(ML10/if(MPOSTS=0,1,MPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as mlb10,
if(cast(round(ROUND(HL/if(TPOSTS=0,1,TPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as hbl,
if(cast(round(ROUND(ML/if(TPOSTS=0,1,TPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as mbl,
if(cast(round(ROUND(LL/if(TPOSTS=0,1,TPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as lbl,
if(cast(round(ROUND(TL2/if(TPOSTS=0,1,TPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as tbl2,
if(cast(round(ROUND(TL3/if(TPOSTS=0,1,TPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as tbl3,
if(cast(round(ROUND(TL4/if(TPOSTS=0,1,TPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as tbl4,
if(cast(round(ROUND(TL5/if(TPOSTS=0,1,TPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as tbl5,
if(cast(round(ROUND(TL5/if(TPOSTS=0,1,TPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as tbl6,
if(cast(round(ROUND(TL7/if(TPOSTS=0,1,TPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as tbl7,
if(cast(round(ROUND(TL8/if(TPOSTS=0,1,TPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as tbl8,
if(cast(round(ROUND(TL9/if(TPOSTS=0,1,TPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as tbl9,
if(cast(round(ROUND(TL10/if(TPOSTS=0,1,TPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as tlb10,
if(cast(round(ROUND(TL11/if(TPOSTS=0,1,TPOSTS),4)*100,1) as
char)=\"0.0\
as char),\"%\")) as tlb11,
if(cast(round(ROUND(TL12/if(TPOSTS=0,1,TPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as tlb12,
if(cast(round(ROUND(TL13/if(TPOSTS=0,1,TPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as tlb13,
if(cast(round(ROUND(LL3/if(WPOSTS=0,1,WPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as wlb3,
if(cast(round(ROUND(LL4/if(WPOSTS=0,1,WPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as wlb4,
if(cast(round(ROUND(LL5/if(WPOSTS=0,1,WPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as wlb5,
if(cast(round(ROUND(LL14/if(WPOSTS=0,1,WPOSTS),4)*100,1) as
char)=\"0.0\as char),\"%\")) as wlb14
from (SELECT B.UNIT_NAME as
UNITNAME,B.WRITER,B.PHONE,B.Real_Person_Num,
if(M_Persont is null,0,M_Persont) as M_Persont,
if(T_Persont is null,0,T_Persont) as T_Persont,
if(L_Persont is null,0,L_Persont) as L_Persont,
if(ML3 is null,0,ML3) as ML3,
if(ML4 is null,0,ML4) as ML4,
if(ML5 is null,0,ML5) as ML5,
if(ML6 is null,0,ML6) as ML6,
if(ML7 is null,0,ML7) as ML7,
if(ML8 is null,0,ML8) as ML8,
if(ML9 is null,0,ML9) as ML9,
if(ML10 is null,0,ML10) as ML10,
if(HL is null,0,HL) as HL,
if(ML is null,0,ML) as ML,
if(LL is null,0,LL) as LL,
if(TL2 is null,0,TL2) as TL2,
if(TL3 is null,0,TL3) as TL3,
if(TL4 is null,0,TL4) as TL4,
if(TL5 is null,0,TL5) as TL5,
if(TL6 is null,0,TL6) as TL6,
if(TL7 is null,0,TL7) as TL7,
if(TL8 is null,0,TL8) as TL8,
if(TL9 is null,0,TL9) as TL9,
if(TL10 is null,0,TL10) as TL10,
if(TL11 is null,0,TL11) as TL11,
if(TL12 is null,0,TL12) as TL12,
if(TL13 is null,0,TL13) as TL13,
if(LL3 is null,0,LL3) as LL3,
if(LL4 is null,0,LL4) as LL4,
if(LL5 is null,0,LL5) as LL5,
if(LL14 is null,0,LL14) as LL14,
if(M_Persont is null,0,M_Persont) as MRATIO,
if(T_Persont is null,0,T_Persont) as TRATIO,
if(L_Persont is null,0,L_Persont) as WRATIO,
if(ML3 is null or length(ML3)=0,0,ML3)+
if(ML4 is null or length(ML4)=0,0,ML4)+
if(ML5 is null or length(ML5)=0,0,ML5)+
if(ML6 is null or length(ML6)=0,0,ML6)+
if(ML7 is null or length(ML7)=0,0,ML7)+
if(ML8 is null or length(ML8)=0,0,ML8)+
if(ML9 is null or length(ML9)=0,0,ML9)+
if(ML10 is null or length(ML10)=0,0,ML10) as MPOSTS,
if(TL2 is null or length(TL2)=0,0,TL2)+
if(TL3 is null or length(TL3)=0,0,TL3)+
if(TL4 is null or length(TL4)=0,0,TL4)+
if(TL5 is null or length(TL5)=0,0,TL5)+
if(TL6 is null or length(TL6)=0,0,TL6)+
if(TL7 is null or length(TL7)=0,0,TL7)+
if(TL8 is null or length(TL8)=0,0,TL8)+
if(TL9 is null or length(TL2)=9,0,TL9)+
if(TL10 is null or length(TL10)=0,0,TL10)+
if(TL11 is null or length(TL11)=0,0,TL11)+
if(TL12 is null or length(TL12)=0,0,TL12)+
if(TL13 is null or length(TL13)=0,0,TL13) as TPOSTS,
if(LL3 is null or length(LL3)=0,0,LL3)+
if(LL4 is null or length(LL4)=0,0,LL4)+
if(LL5 is null or length(LL5)=0,0,LL5)+
if(LL14 is null or length(LL14)=0,0,LL14) as WPOSTS
FROM post_condition A join unit B on A.unit_code=B.unit_code A.unit_code=$P{unitCode} and A.Is_Extra='1') AB
where
因篇幅问题不能全部显示,请点此查看更多更全内容