zOs/TX/PER20COM
with a as
(
select * from a540769.tper20
where hb510001 < '006008'
)
, p as
(
select * from oa1a.thb510a1
where hb510001 < '006008'
)
select count(*) all,
count(a.hb510001) a,
sum(case when a.hb510001 is null then 1 else 0 end) anull,
count(p.hb510001) p,
sum(case when p.hb510001 is null then 1 else 0 end) pnull,
count(a.hb510001 || p.hb510001) both,
sum(case when a.hb510001 is null then 1
when p.hb510001 is null then 1 else 0 end) apnull
from a full outer join p
on a.hb510001 = p.hb510001
and a.hb510174 = p.hb510174
and a.hb510200 = p.hb510200
and a.hb510391 = p.hb510391
and a.hb510027 = p.hb510027
and a.hb510139 = p.hb510139
and a.hb510028 = p.hb510028
and a.hb510138 = p.hb510138
and a.hb510039 = p.hb510039
and a.hb510040 = p.hb510040
and a.hb510368 = p.hb510368
with ur for read only
;x;
select count(*) all
from oa1p.thb510a1 p
where p.hb510001 < '006008'
;x;
SELECT COUNT(*) ALL,
COUNT(A.HB510001) A,
COUNT(P.HB510001) P,
COUNT(A.HB510001 || P.HB510001) BOTH
FROM A540769.TPER20 A
FULL OUTER JOIN OA1A.THB510A1 P
ON A.HB510001 = P.HB510001
AND A.HB510174 = P.HB510174
AND A.HB510200 = P.HB510200
AND A.HB510391 = P.HB510391
AND A.HB510027 = P.HB510027
AND A.HB510139 = P.HB510139
AND A.HB510028 = P.HB510028
AND A.HB510138 = P.HB510138
AND A.HB510039 = P.HB510039
AND A.HB510040 = P.HB510040
AND A.HB510368 = P.HB510368
WITH UR