ไม่ลองนับจาก ovst+ovstdiag ไม่ต้องสนใจโรคหลักโรครอง...join กับตาราง patient +vn_stat ครับ
ลองดูจาก...
select p.hn,concat(pname,fname," ",lname) as pat,v.cid,v.age_y,
op.name,v.hospmain,v.hospsub,v.vstdate,li.lab_items_name,l2.lab_order_result,
ov.icd10,d.name from ovst o
left outer join ovstdiag ov on ov.vn=o.vn
left outer join vn_stat v on v.vn=o.vn
left outer join patient p on p.hn=o.hn
left outer join occupation op on op.occupation=p.occupation
left outer join doctor d on d.code=v.dx_doctor
left outer join lab_head l on l.vn=o.vn
left outer join lab_order l2 on l2.lab_order_number=l.lab_order_number
left outer join lab_items li on li.lab_items_code=l2.lab_items_code
where ov.icd10 like "Z34%" and v.vstdate between "2011-01-01" and "2011-03-31"
group by o.hn,l2.lab_items_code
order by v.vstdate,o.vsttime