ลองใช้คำสั่ง
explain select o.oapp_id,o.vstdate,v.vsttime,o.nextdate,o.nexttime,c.name as clinic_name , d.name as doctor_name,o.app_user,o.app_cause,o.contact_point,count(v2.vn) as visit_count from oapp o left outer join ovst v on v.vn=o.vn left outer join clinic c on c.clinic=o.clinic left outer join doctor d on d.code=o.doctor left outer join ovst v2 on v2.vstdate = o.nextdate where o.hn='0124027' group by o.oapp_id,o.vstdate,v.vsttime,o.nextdate,o.nexttime,c.name , d.name ,o.app_user,o.app_cause,o.contact_point order by o.vstdate desc
แล้วส่งผลเข้ามาด้วยครับ