哦,谢谢啦,似乎是有点明白啦 还有一个问题想问问斑竹哦 SELECT SNAME FROM Students WHERE SNO IN (SELECT SC.SNO FROM SC WHERE SC.CNO IN (SELECT FCourses.FCNO FROM FCourses WHERE FCourses.CNO='CS-201') AND GRADE>60)
我想让SC.CNO中的所有值都能满足SELECT FCourses.FCNO FROM FCourses WHERE FCourses.CNO='CS-201'的FCourses.FCNO时才选择,该怎么改这个代码呢?
你是要这样的效果? SELECT SNAME FROM Students WHERE SNO IN ( SELECT SC.SNO FROM SC INNER JOIN ( SELECT FCourses.FCNO FROM FCourses WHERE FCourses.CNO='CS-201' ) a ON SC.CNO=a.FCNO AND GRADE>60 )
最近思路有点僵掉了 这个怎么样? SELECT SNAME FROM Students WHERE SNO IN ( SELECT SNO FROM SC INNER JOIN ( SELECT FCourses.FCNO FROM FCourses WHERE FCourses.CNO='CS-201' ) T1 ON T1.FCNO = CNO GROUP BY SNO HAVING COUNT(T1.FCNO)=( SELECT COUNT(FCNO) FROM FCourses WHERE CNO='CS-201') AND GRADE>60 )