SELECT herw98.p02 as p02, 
       ifnull(d00.p801, '') as p801, 
       ifnull(d00.p802, '') as p802, 
       ifnull(heru01.p300, 0) as p300
FROM herw98
LEFT JOIN d00 ON d00.nr01={peg_nnn}
LEFT JOIN heru01 ON heru01.p00={peg_nnn}
WHERE herw98.nr01=1;
       
       