SELECT visitepi.pid,visitepi.vaccinecode
FROM visitepi
INNER JOIN person p ON p.pid=visitepi.PID
where p.BIRTH > visitepi.dateepi and visitepi.vaccinecode in ('BCG','HBV1')
group by visitepi.pid,visitepi.vaccinecode;