Wondering if someone could help me out here. My query is trying to insert students into another table if their standing is 4 but not if those students with standing 4 have a course code equal to TR051 or Tr052. At the moment its inserting all students not doing TR051 or TR052 regardless of standing. Is there such a thing as insert into if 4 unless TR051 or TR052??
INSERT INTO tblFinalYrs ( STU_ID, STU_FORENAME, STU_SURNAME, STU_STANDING, STU_COURSE_CODE, STU_TU_CODE, STU_FAC_NO, STU_EMAIL )
SELECT tblStudents.STU_ID, tblStudents.STU_FORENAME, tblStudents.STU_SURNAME, tblStudents.STU_STANDING, tblStudents.STU_COURSE_CODE, tblStudents.STU_TU_CODE, tblStudents.STU_FAC_NO, tblStudents.STU_EMAIL
FROM tblStudents
WHERE (((tblStudents.STU_STANDING)=4) AND ((tblStudents.STU_COURSE_CODE)<>"TR051")) OR (((tblStudents.STU_COURSE_CODE)<>"TR052"));
INSERT INTO tblFinalYrs ( STU_ID, STU_FORENAME, STU_SURNAME, STU_STANDING, STU_COURSE_CODE, STU_TU_CODE, STU_FAC_NO, STU_EMAIL )
SELECT tblStudents.STU_ID, tblStudents.STU_FORENAME, tblStudents.STU_SURNAME, tblStudents.STU_STANDING, tblStudents.STU_COURSE_CODE, tblStudents.STU_TU_CODE, tblStudents.STU_FAC_NO, tblStudents.STU_EMAIL
FROM tblStudents
WHERE (((tblStudents.STU_STANDING)=4) AND ((tblStudents.STU_COURSE_CODE)<>"TR051")) OR (((tblStudents.STU_COURSE_CODE)<>"TR052"));