เพิ่มรายการ joint ใน script ตามนี้ครับ
select d1.*,concat('(',d1.doctor_name,')') as doctorname,v1.*,o1.*,s.*,t.blobtext,t.blobtext2,pe.image1,
a.agent,a.symptom as allergysymptom,a.reporter,o.nextdate,o.nexttime,o.app_user,o.app_cause,o.contact_point,o.note1,o.note2
from doctor_order_print d1
left outer join vn_stat v1 on v1.vn=d1.vn
left outer join ovst o1 on o1.vn=d1.vn
left outer join opdscreen s on s.vn = d1.vn
left outer join opd_allergy a on a.hn=d1.hn
left outer join oapp o on o.vn=d1.vnleft outer join pe_image pe on pe.vn=d1.vn
left outer join tempreport t on t.name=d1.vn and t.reportname="DOCTOR-FORM"
where d1.vn="500318080406" and d1.print_server="OPD"