select * from student a,class b,grade c where a.s_id=c.s_id and b.c_id=c.C_id and (c.C_id='001' or c.c_id='002')

解决方案 »

  1.   

    select c.s_name,c.s_id from student c,
      (select a.s_id  from grade a,class b 
         where a.c_id = b.c_id and b.c_name in ('001','002')) as tb1
       where c.s_id = tb1.s_id
      

  2.   

    给出的条件不完整。成绩表上没有出现的学生就一定没选该门课吗?如果是这样,则:select b.c_id,a.s_name from student a, grade b where a.s_id=b.s_id and (b.s_id='001' or b.s_id='002')
      

  3.   

    只要列出姓名是吧?
    select s_id as 学号,s_name as 学生姓名
        from student where s_id in(select s_id from grade where c_id in('001','002'))不过,正如楼上所讲,你的条件有些问题.