select i1.*,i2.*,p.*,id.*,concat(pname,fname," ",lname) as fullname ,pty.name as pttype_name,w.name as ward_name
,concat(i2.age_y,"ปี",i2.age_m,"เดือน",i2.age_d,"วัน") as Fage from ipt i1,iptadm id,an_stat i2,patient p,pttype pty,ward w
where i1.an=i2.an and i1.hn=p.hn and id.an=i1.an and pty.pttype=i2.pttype and w.ward=i1.ward and i1.an="500002563"
concat(i2.age_y,"ปี",i2.age_m,"เดือน",i2.age_d,"วัน")