ขอบคุณ อ.อุดมโชค ครับ
SELECT
a.an,p.hn,concat(p.pname,p.fname," ",p.lname) AS ptname,
a.age_y,lh.order_date,lig.lab_items_group_name,
li.lab_items_name,lo.lab_order_result,lh.form_name,
li.lab_items_unit,li.lab_items_normal_value,lo.confirm,
w.`name`,ia.bedno,lh.order_department,k.department,
lab_items_sub_group.lab_items_sub_group_name
FROM an_stat AS a
LEFT OUTER JOIN patient AS p ON p.hn = a.hn
LEFT OUTER JOIN lab_head AS lh ON a.an = lh.vn
LEFT OUTER JOIN lab_order AS lo ON lh.lab_order_number = lo.lab_order_number AND lo.confirm = "Y"
LEFT OUTER JOIN lab_items AS li ON lo.lab_items_code = li.lab_items_code
LEFT OUTER JOIN lab_form_head AS lfh ON lh.form_name = lfh.form_name
LEFT OUTER JOIN ward AS w ON a.ward = w.ward
LEFT OUTER JOIN iptadm AS ia ON a.an = ia.an
LEFT OUTER JOIN kskdepartment AS k ON lh.order_department = k.depcode
LEFT OUTER JOIN lab_items_group AS lig ON li.lab_items_group = lig.lab_items_group_code
INNER JOIN lab_items_sub_group ON lo.lab_items_sub_group_code = lab_items_sub_group.lab_items_sub_group_code
WHERE a.an = "630001403" AND lo.lab_order_result <> ""
ORDER BY lh.form_name,lig.lab_items_group_code,lh.order_date