50个查询系列-第8个查询:查询课程编号“002”的成绩比课程编号“001”课程低的所有同学的学号、姓名;

做法:

select tblstudent.StuId,tblstudent.StuName from tblstudent where
(
(select tblscore.Score from tblscore where tblstudent.StuId=tblscore.StuId and tblscore.CourseId=002)
<(select tblscore.Score from tblscore where tblstudent.StuId=tblscore.StuId and tblscore.CourseId=001)
)

 

文章来自:http://www.cnblogs.com/shenxiaoquan/p/6120207.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3