网吧没有SQL,我是脑子想的。
select so.soname as '课程名' ,st.sname as '学生名字'
from stu as st join score as sc
on st.sid = sc.sid join sourses as so on
so.soid = sc.soid
group by st.sid
having min(sc.scores)>=60
你试下看行不行,楼下帮忙指正下。
SELECT * FROM stu WHERE sid IN
(SELECT sid FROM (SELECT sid,SUM(soid) FROM score GROUP BY sid WHERE scores>=60 ) WHERE SUM(soid)
=(SELECT SUM(soid) FROM sourses))
select st.sname as '学生名字'
from stu as st join score as sc
on st.sid = sc.sid join sourses as so on
so.soid = sc.soid
group by st.sid,st.sname
having min(sc.scores)>=60
上面的group by写错了,应该加个st.sname