Question

I have two Tables:

Course: Id, Name

Teacher: IdUser, IdCourse, IdSchool

Now, for Example I have a user with the id 10 and a School with the id 4 .

I want to make a Select over all the Cousrses in the table Course, that their Id are NOT recorded in the Table Teacher at the same line with the IdUser 10 and IdSchool 4.

How could I make this query?

Was it helpful?

Solution

SELECT Id, Name
FROM Course
WHERE Id NOT IN (
    SELECT IdCourse 
    FROM Teacher 
    WHERE IdUser = 10 AND IdSchool = 4
);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top