try:
select a.ND,to_char(a.WGRQ,'mm') as YF ,sum(a.ZPC) , 
count(select count(SXX) from AJWC22 g 
where  to_char(WGRQ,'mm')>= to_char(a.WGRQ,'mm') group by ND,GQ)
 as XSS 
from AJWC21 a  
group by to_char(a.WGRQ,'mm') ,a.ND