โทษทีครับติดธุระอยู่ครับ
select distinct p.hn, concat(p.pname, p.fname,' ', p.lname) as ptname,
p.addrpart, p.moopart, a.pdx, i.name as diagname, t.full_name
from an_stat a
left outer join patient p on p.hn=a.hn
left outer join icd101 i on i.code=a.pdx
left outer join thaiaddress t on t.addressid=a.aid
where a.pdx in ("J449","J441","J459")
and a.regdate between '2007-06-01' and '2008-06-27'
and p.amppart="02" and p.chwpart="80" and
a.age_y>"65"