select distinct( tblstudent.StuId) from tblstudent ,

tblscore
where  tblscore.CourseId
 in
(
select tblscore.CourseId from tblscore where tblscore.StuId='1001' 
)
and tblstudent.StuId=tblscore.StuId

  答案提供两种方法;

1:

Select DistInct st.StuId,StuName From tblStudent st
  Inner Join tblScore sc ON st.StuId=sc.StuId
   Where sc.CourseId IN (Select CourseId From tblScore Where StuId='1001')

2:

 ------嵌套子查询
 Select StuId,StuName From tblStudent
  Where StuId In
  (
   Select Distinct StuId From tblScore Where CourseId In (Select CourseId From tblScore Where StuId='1001')
  )

 

相关文章:

  • 2021-06-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-14
  • 2022-12-23
  • 2021-08-24
  • 2021-12-28
  • 2022-12-23
  • 2021-07-20
相关资源
相似解决方案