เอา SQL ไปใช้ก่อนได้ครับ
select p5.*,p1.*,concat(p2.pname,p2.fname," ",p2.lname) as person_name, s1.person_dm_screen_status_name, s2.person_ht_screen_status_name , s3.person_stroke_screen_status_name , s4.person_obesity_screen_status_name,d1.person_dmht_manage_type_name , p2.age_y,h1.address,concat(v.village_name," ËÁÙè ",v.village_moo) as village_name,p2.death
from person_dmht_screen_summary p1
left outer join person p2 on p2.person_id = p1.person_id
left outer join house h1 on h1.house_id = p2.house_id
left outer join village v on v.village_id = h1.village_id
left outer join person_dm_screen_status s1 on s1.person_dm_screen_status_id = p1.person_dm_screen_status_id
left outer join person_ht_screen_status s2 on s2.person_ht_screen_status_id = p1.person_ht_screen_status_id
left outer join person_stroke_screen_status s3 on s3.person_stroke_screen_status_id = p1.person_stroke_screen_status_id
left outer join person_obesity_screen_status s4 on s4.person_obesity_screen_status_id = p1.person_obesity_screen_status_id
left outer join person_dmht_manage_type d1 on d1.person_dmht_manage_type_id = p1.person_dmht_manage_type_id
left outer join person_dmht_risk_screen_head p5 on p5.person_dmht_screen_summary_id = p1.person_dmht_screen_summary_id
where p1.bdg_year = 2554 and p1.status_active="Y"
and p5.screen_date between "2011-10-01" and "2011-11-14"
order by p5.screen_date