ได้แร้วคาฟฟฟฟ
select i.an,i.hn,i.regdate,
l.g as group_1, l.t as group_2, l.p as group_3, l.a as group_4, l.l as group5 ,
l.edc,
f.sex, f.birth_weight, f.body_length, f.head_length, f.temperature, f.hr, f.rr ,
n.an as an_child, f.hn as hn_child, concat(p.pname,p.fname) as fname, p.lname as lname_child,
a.age_y,a.age_m , a.age_d
FROM ipt i
LEFT OUTER JOIN ipt_labour l ON l.an = i.an
LEFT OUTER JOIN ipt_labour_infant f ON f.ipt_labour_id = l.ipt_labour_id
LEFT OUTER JOIN patient p ON p.hn = f.hn
LEFT OUTER JOIN ipt_newborn n ON n.mother_an = i.an
LEFT OUTER JOIN an_stat a ON a.an = n.an
WHERE i.an= "580000796"