SELECT p.pcucodeperson,p.pid,e.dateepi,e.vaccinecode FROM person p
INNER JOIN (SELECT pcucode,pid,dateepi ,vaccinecode from visitepi e where e.vaccinecode='mmr' AND e.dateepi BETWEEN '20131001' AND '20140930' ) as  e ON p.pid=e.pid
WHERE   p.birth between '20121001' and '20130930' ;
