SELECT personstudent.pid,CONCAT(ctitle.titlename,person.fname," ",person.lname),person.idcard,cschoolclass.classname
,convert(concat(getAgeYearNum(birth,curdate())," ปี ",getAgeMonthNum(birth,curdate())," เดือน ",getAgeDayNum(birth,curdate())," วัน ")using utf8)as age 
,house.hno,right(house.villcode,2)as mu,villageschool.schoolname#,studenthealthcheck.result,LAST_DAY(studenthealthcheck.dateservice)
FROM personstudent
INNER JOIN person on personstudent.pcucodeperson = person.pcucodeperson and personstudent.pid=person.pid
INNER JOIN ctitle on person.prename=ctitle.titlecode
INNER JOIN house on person.pcucodeperson=house.pcucodeperson and person.hcode=house.hcode
INNER JOIN cschoolclass on personstudent.classeducate=cschoolclass.classcode
INNER JOIN villageschool on personstudent.schoolno=villageschool.schoolno
#LEFT JOIN studenthealthcheck ON personstudent.pid=studenthealthcheck.pid AND personstudent.pcucodeperson=studenthealthcheck.pcucodeperson

ORDER BY personstudent.classeducate #ปรับเพิ่ม order by 