select a.student_name,d.class_name,c.course_name from a,b,c,d,e where a.student_id = e.student_id and a.class_id = d.class_id and b.teacher_id = c.teacher_id and c.course_id = e.course_id group by d.class_name
还少一个未参加考试的条件
你的表设计有问题,应该为多对多关系吧,
select student_num,student_name,sex,age,student_classfrom
student_message
group by student_num
having avg(student_grade)>(select avg(student_grade) where student_name='刘晨' limit 0,1)
把表的结构贴出来--
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)