We help IT Professionals succeed at work.
Get Started

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

431 Views
Last Modified: 2012-05-11
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
Comment
Watch Question
Top Expert 2011
Commented:
This problem has been solved!
Unlock 1 Answer and 15 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE