ขาดช่อง Diag ของผู้ป่วย ต้องใส่อะไรตรงบรรทัดไหนบ้างครับ
SELECT 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,p2.death_date,h2.house_regist_type_name
FROM person_dmht_screen_summary p1
LEFT OUTER JOIN person p2 on p2.person_id = p1.person_id
LEFT OUTER JOIN house_regist_type h2 on h2.house_regist_type_id = p2.house_regist_type_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
WHERE p1.bdg_year = 2557
AND p1.status_active='Y'
ORDER BY v.village_moo,h1.address