select CYKBMC BMMC00,CYKB00,GDBAZS,JSRGDS,LSRGDS,SSRGDS,SSRNGD,QRNGD0,WRNGD0,SRNGD0,LRNGD0,
decode(A.BACYZS,0,'0.00',decode(A.JSRGDS,0,'0.00',round(A.JSRGDS/A.BACYZS* 100 ,2)))||'%' JSRGDL,
decode(A.BACYZS,0,'0.00',decode(A.LSRGDS,0,'0.00',round(A.LSRGDS/A.BACYZS* 100 ,2)))||'%' LSRGDL,
decode(A.BACYZS,0,'0.00',decode(A.SSRGDS,0,'0.00',round(A.SSRGDS/A.BACYZS* 100 ,2)))||'%' SSSGDL,
decode(A.BACYZS,0,'0.00',decode(A.SSRNGD,0,'0.00',round(A.SSRNGD/A.BACYZS* 100 ,2)))||'%' SSRGDL,
decode(A.BACYZS,0,'0.00',decode(A.QRNGD0,0,'0.00',round(A.QRNGD0/A.BACYZS* 100 ,2)))||'%' QRGDL0,
decode(A.BACYZS,0,'0.00',decode(A.WRNGD0,0,'0.00',round(A.WRNGD0/A.BACYZS* 100 ,2)))||'%' WRGDL0,
decode(A.BACYZS,0,'0.00',decode(A.SRNGD0,0,'0.00',round(A.SRNGD0/A.BACYZS* 100 ,2)))||'%' SRGDL0,
decode(A.BACYZS,0,'0.00',decode(A.LRNGD0,0,'0.00',round(A.LRNGD0/A.BACYZS* 100 ,2)))||'%' LRGDL0,
decode(A.BACYZS,0,'0.00',decode(A.YRNGD0,0,'0.00',round(A.YRNGD0/A.BACYZS* 100 ,2)))||'%' YRGDL0,YRNGD0,BACYZS

from(
select A.CYKB00,a.cykbmc,sum(case when qsrq00 is null then 0 else 1 end) GDBAZS,
sum(case when qsrq00 is null then 0 when SF_BA_GETCOMPAREDATE2(a.CYRQ00,a.QSRQ00)<=90  then 1 else 0 end) JSRGDS,
sum(case when qsrq00 is null then 0 when SF_BA_GETCOMPAREDATE2(a.CYRQ00,a.QSRQ00)<=60  then 1 else 0 end) LSRGDS,
sum(case when qsrq00 is null then 0 when SF_BA_GETCOMPAREDATE2(a.CYRQ00,a.QSRQ00)<=30  then 1 else 0 end) SSRGDS,
sum(case when qsrq00 is null then 0 when SF_BA_GETCOMPAREDATE2(a.CYRQ00,a.QSRQ00)<=14  then 1 else 0 end) SSRNGD,
sum(case when qsrq00 is null then 0 when SF_BA_GETCOMPAREDATE2(a.CYRQ00,a.QSRQ00)<=7  then 1 else 0 end) QRNGD0,
sum(case when qsrq00 is null then 0 when SF_BA_GETCOMPAREDATE2(a.CYRQ00,a.QSRQ00)<=5  then 1 else 0 end) WRNGD0,
sum(case when qsrq00 is null then 0 when SF_BA_GETCOMPAREDATE2(a.CYRQ00,a.QSRQ00)<=3  then 1 else 0 end) SRNGD0,
sum(case when qsrq00 is null then 0 when SF_BA_GETCOMPAREDATE2(a.CYRQ00,a.QSRQ00)<=2  then 1 else 0 end) LRNGD0,
sum(case when qsrq00 is null then 0 when  SF_BA_GETCOMPAREDATE2(a.CYRQ00,a.QSRQ00)<=1  then 1 else 0 end) YRNGD0,
count(distinct a.lsh000) BACYZS
from ba_brzyxx A left join  zy_brxxb0 b on a.lsh000=b.zyid00 where a.CYRQ00>='20241101' and a.CYRQ00<='20241130' 
and cykb00 in (select bmbh00 from bm_bmbm00 where yyid00 ='228445' )
group by cykbmc,CYKB00 ) A left join bm_bmbm00  bm  on a.CYKB00=bm.bmbh00 where 1=1   order by bm.pxxh00  