-- 查询两门及其以上不及格课程的同学的学号,姓名及其平均成绩
select t1.s_id, t1.s_name, t3.avg_score from student t1, ( select t2.s_id, round(avg(s_score)) as avg_score from ( select * from score where s_score < '60') t2 group by t2.s_id having count(t2.s_id) >= 2) t3 where t1.s_id = t3.s_id
select a.s_id, a.s_name, round(avg(b.s_score)) from student a left join score b on a.s_id = b.s_id where a.s_id in( select s_id from score where s_score<60 group by s_id having count(1)>= 2) group by a.s_id, a.s_name
--2019/4/25
