select where only
-
Hi! I have a table Validation: Id_student --- - id_semestre ----- id_validation 102----------- - 1 ---------------- 4 102----------- - 1 ---------------- 3 -- 102----------- - 2 ---------------- 4 103----------- - 1 ---------------- 4 104----------- - 2 ---------------- 3 104----------- - 2 ---------------- 4 I want to select students who have in semestre 2 id_validation = 4 only . in the example i want have : 102 students, not 102 and 104 thank you.
-
Hi! I have a table Validation: Id_student --- - id_semestre ----- id_validation 102----------- - 1 ---------------- 4 102----------- - 1 ---------------- 3 -- 102----------- - 2 ---------------- 4 103----------- - 1 ---------------- 4 104----------- - 2 ---------------- 3 104----------- - 2 ---------------- 4 I want to select students who have in semestre 2 id_validation = 4 only . in the example i want have : 102 students, not 102 and 104 thank you.
This works (using a correlated subquery), but I'm sure it's not the only way to get the correct results: select v1.id_student from validation v1 where v1.id_semestre = 2 and v1.id_validation=4 and not exists (select id_student from validation v2 where id_semestre = 2 and id_validation<>4 and V1.ID_STUDENT = V2.ID_STUDENT ) Scott
-
This works (using a correlated subquery), but I'm sure it's not the only way to get the correct results: select v1.id_student from validation v1 where v1.id_semestre = 2 and v1.id_validation=4 and not exists (select id_student from validation v2 where id_semestre = 2 and id_validation<>4 and V1.ID_STUDENT = V2.ID_STUDENT ) Scott