ผมเขียนประมาณนี้ถูกไหมครับ ขอคำแนะนำด้วยครับ
select
p.person_id,p.cid,concat(p.pname,p.fname," ",p.lname) as ptname,p.birthdate
,w.vaccine_bcg_date,w.vaccine_hbv1_date,w.vaccine_hbv2_date,w.vaccine_hbv3_date,w.vaccine_dtphb1_date,w.vaccine_opv1_date,w.vaccine_dtphb2_date
,w.vaccine_opv2_date,w.vaccine_dtphb3_date,w.vaccine_opv3_date,w.vaccine_mmr_date
,e.vaccine_dtp4_date,e.vaccine_opv4_date,e.vaccine_je1_date,e.vaccine_je2_date,e.vaccine_je3_date,e.vaccine_dtp5_date,e.vaccine_opv5_date
from
person p
left outer join person_wbc w on w.person_id = p.person_id
left outer join person_epi e on e.person_id = p.person_id
where p.age_y >=1 and p.age_y <=5