SELECT
   a00.p21  as p21,
   a00.p010 as p010,
   a00.p19  as p19,
   a00.p2   as p2,
   a00.p3   as p3,
   a00.p4   as p4,
   a00.p5   as p5,
   a00.p7   as p7,
   a00.p8   as p8,
   a00.p9   as p9,
   t00.nr01 as t00nr01
FROM a00
LEFT JOIN t00 ON t00.p01=a00.p21
WHERE t00.nr01 is null

UNION ALL

SELECT
   a01.p21  as p21,
   a01.p010 as p010,
   a01.p19  as p19,
   a01.p2   as p2,
   a01.p3   as p3,
   a01.p4   as p4,
   a01.p5   as p5,
   a01.p7   as p7,
   a01.p8   as p8,
   a01.p9   as p9,
   t00.nr01 as t00nr01
FROM a01
LEFT JOIN t00 ON t00.p01=a01.p21
WHERE t00.nr01 is null  ;


