select a.*,b.考勤次数 from 学生信息表 a (select s_id,count(*) as 考勤次数 from 学生考勤表 group by s_id)b where a.s_id=b.s_id order by b.考勤次数 desc;