เพิ่มที่อยู่ให้แล้วครับ
select distinct(o.hn),concat(pname,fname," ",lname) as pat,v.vstdate,o.icd10,v.age_y,v.age_m, p.moopart, v.aid, t.full_name
from ovstdiag o
left outer join vn_stat v on v.vn=o.vn
left outer join patient p on p.hn=o.hn
left outer join thaiaddress t on t.addressid=v.aid
WHERE o.icd10 in ("E110","E119") and v.age_y between 1 and 60 and v.vstdate between"2010-01-01" and "2010-12-31"
and o.hn not in (select distinct(o.hn) from ovstdiag o left outer join vn_stat v on v.vn=o.vn where o.icd10 in ("E110","E119") AND v.age_y between "1" and "60" and v.vstdate <="2010-01-01" )