新手求助!?表中有三列分别是XH(学号),KCH(课程号),
sql吧
全部回复
仅看楼主
level 3
新手求助!?
表中有三列分别是XH(学号),KCH(课程号),CJ(成绩),
查询表,要求列出选修了课程号为"1101"和"1102"的课程,且课程1101的成绩大于课程1102成绩的所有学号和成绩
提示:用到子查询
2019年02月10日 06点02分 1
level 3
有大佬可以教我一下吗??拜托了
2019年02月10日 08点02分 2
level 12
试试对不对呢
select * from 表
where xh in
(select t1.xh from (select xh,kch,cj from 表
where kch ='1101' or kch='1102') as t1,(select xh,kch,cj from 表
where kch ='1101' or kch='1102') as t2
where t1.xh=t2.xh
and t1.kch='1001'
and t2.kch='1002'
and t1.cj>t2.cj)
2019年02月10日 15点02分 3
是对的,非常感谢[呵呵]
2019年02月11日 11点02分
1