select p.hn,p.cid,concat(p.pname,p.fname," ",p.lname) as fullname,p.addrpart,p.birthday,( YEAR(CURDATE()) - YEAR(p.birthday)) AS age,
concat(" ËÁÙè·Õè ",p.moopart) as moo,concat(" µ.",t3.name) as tmb,concat(" Í.",t2.name) as amp,concat(" ¨.",t1.name) as chw
from patient p
left outer join thaiaddress t1 on t1.chwpart=p.chwpart and
t1.amppart="00" and t1.tmbpart="00"
left outer join thaiaddress t2 on t2.chwpart=p.chwpart and
t2.amppart=p.amppart and t2.tmbpart="00"
left outer join thaiaddress t3 on t3.chwpart=p.chwpart and
t3.amppart=p.amppart and t3.tmbpart=p.tmbpart
where citizenship in ('48','56','57') or nationality in ('48','56','57')
พม่า ลาว กัมพูชา