//查询出某个班级对应的所有老师和学生
1、使用嵌套结果
select * from classes c,teacher t,student s where c.teacher_id = t.t_id and c.c_id = s.class_id where c_id = #{id}
2、使用嵌套查询
select * from classes where c_id = #{id};
select * form teacher where t_id = #{id}
select * from student where class_id = #{id}
原文:http://www.cnblogs.com/hy87/p/6216535.html