I have the following three tables:

ClassHeader
ClassID
Major

TeacherClasses
TeacherID
ClassID

StudentClasses
TeacherID
Major

I want to select all TeacherClasses where the a given Major = ClassHeader.Major

I have the following three tables:

ClassHeader
ClassID
Major

TeacherClasses
TeacherID
ClassID

StudentClasses
TeacherID
Major

I want to select all TeacherClasses where the a given Major = ClassHeader.Major

A user on another Forum gave me this solution which worked:

SELECT TeacherClasses.TeacherId, TeacherClasses.ClassId
FROM ClassHeader INNER JOIN TeacherClasses ON TeacherClasses.ClassID = ClassHeader.ClassID
WHERE ClassHeader.Major = 'BasketWeaving'
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.