有2个表,一个是学生表,一个是选修历史的学生表,
选择没有选修历史的学生名单,这个怎么写?
谢谢!1.students
index name 。。
1 小王 ........
2 小李 ........
2.class
index students.index
1 1
2 5
选择没有选修历史的学生名单,这个怎么写?
谢谢!1.students
index name 。。
1 小王 ........
2 小李 ........
2.class
index students.index
1 1
2 5
select index from student except select index from class
name
from
students
where
not exists(select 1 from class where `students.index`=students.index and 课程='历史')