อันนี้ ยังแก้ไม่หายนะครับไม่ทราบวิธีการเขียนคำสั่งกรุ๊บ
ผมมีอีกปัญหาครับ
select distinct pt.hn ,concat(pt.pname,pt.fname,' ',pt.lname)as name ,vn.sex ,
lo.lab_items_name_ref, lo.lab_order_result,
lo1.lab_items_name_ref, lo1.lab_order_result,
lo2.lab_items_name_ref, lo2.lab_order_result,
lo3.lab_items_name_ref, lo3.lab_order_result,
ov.vstdate,op.bpd AS BP_hi,op.bps AS BP_down, op.bw,op.height,
op.bw/((op.height/100)*(op.height/100)) as BMI , vn.age_y ,cn.clinic,
op.fh ,op.sh
from vn_stat vn
left outer join patient pt on vn.hn = pt.hn
left outer join ovst ov on vn.hn = ov.hn
left outer join clinic cl on vn.pdx = cl.icd10
left outer join clinicmember cn on vn.hn = cn.hn
left outer join opdscreen op on vn.hn = op.hn
left outer join lab_head lh on vn.hn = lh.hn
left outer join lab_order lo on lh.lab_order_number = lo.lab_order_number
left outer join lab_order lo1 on lh.lab_order_number = lo1.lab_order_number
left outer join lab_order lo2 on lh.lab_order_number = lo2.lab_order_number
left outer join lab_order lo3 on lh.lab_order_number = lo3.lab_order_number
where vn.vstdate between '2010-11-1' and '2010-11-30'
and cn.clinic = '001'
and lo.lab_items_code = '39'
and lo1.lab_items_code = '296'
and lo2.lab_items_code = '127'
and lo3.lab_items_code = '397'
group by op.hn
limit 10
ถ้า group by รันไม่ไปเลย ครับ ค้าง ทั้งระบบเลย ครับ ควรทำอย่างไรดีครับ