Version hosxp และ mysql ตามหัวเรื่องครับ trace mysql มาให้ดูครับ 2 ตอนครับ
****1*** Date Time Type Exec Time SQL Text
52-06-03 16:16:22.187 SQL 2,266 select h.village_id,h.address,p.* ,pc.name as pttype_name,x.name as sex_name ,n.name as nationality_name, concat(p2.fname,' ',p2.lname) as father_name , concat(p3.fname,' ',p3.lname) as mother_name , concat(p4.fname,' ',p4.lname) as couple_name , e.name as education_name ,o.name as occupation_name,r.name as religion_name , y.name as marrystatus_name ,t.house_regist_type_name , f.family_no , pp.person_house_position_name from person p left outer join house h on h.house_id = p.house_id left outer join pttype pc on pc.pttype = p.pttype left outer join sex x on x.code = p.sex left outer join nationality n on n.nationality = p.nationality left outer join education e on e.education = p.education left outer join occupation o on o.occupation = p.occupation left outer join religion r on r.religion = p.religion left outer join marrystatus y on y.code = p.marrystatus left outer join person p2 on p2.person_id = p.father_person_id left outer join person p3 on p3.person_id = p.mother_person_id left outer join person p4 on p4.person_id = p.couple_person_id left outer join person_house_position pp on pp.person_house_position_id = p.person_house_position_id left outer join family f on f.family_id = p.family_id left outer join house_regist_type t on t.house_regist_type_id = p.house_regist_type_id where p.death = 'N' order by round(h.address),p.person_id
*******2*****Date Time Type Exec Time SQL Text
52-06-03 16:16:18.718 SQL 3,391 select v.village_moo,v.village_id,v.village_name,v.latitude,v.longitude,count(distinct h.house_id) as house_count, count(distinct p.person_id) as person_count , count(ps1.person_id) as male_count , count(ps2.person_id) as female_count , count(ps3.person_id) as death_count from village v left outer join house h on h.village_id = v.village_id left outer join person p on p.house_id = h.house_id left outer join person ps1 on ps1.person_id = p.person_id and ps1.sex = '1' and ps1.death='N' left outer join person ps2 on ps2.person_id = p.person_id and ps2.sex = '2' and ps2.death='N' left outer join person ps3 on ps3.person_id = p.person_id and ps3.death = 'Y' group by v.village_moo,v.village_id,v.village_name ,v.latitude,v.longitude order by v.village_id