Avatar of nocturn4l
nocturn4l

asked on 

Help with "IN" and "NOT IN" (MS Access)

Tables
Teacher = [CourseN, Quarter,TeacherName]
Course = [Course N Quarter , DayTime,  Room #]/ Examples of DayTime: M 2:00,
W 4:50, and T 8:00.
Student = [studentName,Course #, Quarter]

^The underlined words are the primary keys

I'm trying to list the names of all the students who haven't taken a class taught by a teacher name.. say John Doe.. so I have

SELECT A.studentName
FROM Student AS A
WHERE A.CourseN EXIST
(SELECT B.CourseN
FROM Teacher B
WHERE B.TeacherName<>"John Doe" AND A.CourseN=B.CourseN);

to me it makes perfecct sense... but obviously it's not because it's coming out with not what i'm looking for.. can someone explain why this is wrong and the correct way of doing this?  Thanks
Microsoft AccessSQL

Avatar of undefined
Last Comment
dqmq

8/22/2022 - Mon