select t.*,
(select count(*)
from ab21 j
where j.AAB001 = t.aab001
and j.BAB214 = '1'
and (j.bab212 = '0' or j.bab212 is null)) zxrs,
(select count(*)
from ab21 k
where k.aab001 = t.aab001
and (k.bab214 <> '1' or k.bab214 is null)
and (k.bab212 = '0' or k.bab212 is null)) tjrs
from (select tempab21.rs,
tempab01.aab001,
tempab01.aab004,
tempab01.AAB019,
tempab01.AAB022,
tempab01.AAB003
from (select aab001, count(aab001) rs
from ab21
WHERE bze001 = '10000000000864'
and (bab212 = '0' or bab212 is null)
group by aab001) tempab21,
ab01 tempab01
where tempab21.aab001 = tempab01.aab001) t
(select count(*)
from ab21 j
where j.AAB001 = t.aab001
and j.BAB214 = '1'
and (j.bab212 = '0' or j.bab212 is null)) zxrs,
(select count(*)
from ab21 k
where k.aab001 = t.aab001
and (k.bab214 <> '1' or k.bab214 is null)
and (k.bab212 = '0' or k.bab212 is null)) tjrs
from (select tempab21.rs,
tempab01.aab001,
tempab01.aab004,
tempab01.AAB019,
tempab01.AAB022,
tempab01.AAB003
from (select aab001, count(aab001) rs
from ab21
WHERE bze001 = '10000000000864'
and (bab212 = '0' or bab212 is null)
group by aab001) tempab21,
ab01 tempab01
where tempab21.aab001 = tempab01.aab001) t