Please look at this query. It works as below, but if I add a new record to the table ISORequirements and run this query, it doesn't append the new record to the Table TrainingRecords. Any idea why??
For Example..
If TrainingRecords & ISORequirements already have a record as follow.
EmpNum = 100 IsoNum = 1.1.1
Running the query would do nothing. Which is what I want, but if I go and add another record for EmpNum 100 in ISORequirements as follow.
EmpNum = 100 ISONum = 1.1.2
then run the query below, it doesn't add the new record to TrainingRecord table.
What I want is TrainingRecords to have
EmpNum = 100 ISONum = 1.1.1
EmpNum = 100 ISONum = 1.1.2
INSERT INTO TrainingRecords ( EmpNum, ISONum, TrainDate )
SELECT EmployeeInfo.EmpNum, ISORequirements.ISONum, Null AS Expr1
FROM EmployeeInfo INNER JOIN ISORequirements ON EmployeeInfo.JobNum = ISORequirements.JobNum
WHERE (((EmployeeInfo.EmpNum) Not In (SELECT Distinct EmployeeInfo.EmpNum
FROM (EmployeeInfo INNER JOIN TrainingRecords ON EmployeeInfo.EmpNum = TrainingRecords.EmpNum) INNER JOIN ISORequirements ON (ISORequirements.ISONum = TrainingRecords.ISONum) AND (EmployeeInfo.JobNum = ISORequirements.JobNum))));
TIA
For Example..
If TrainingRecords & ISORequirements already have a record as follow.
EmpNum = 100 IsoNum = 1.1.1
Running the query would do nothing. Which is what I want, but if I go and add another record for EmpNum 100 in ISORequirements as follow.
EmpNum = 100 ISONum = 1.1.2
then run the query below, it doesn't add the new record to TrainingRecord table.
What I want is TrainingRecords to have
EmpNum = 100 ISONum = 1.1.1
EmpNum = 100 ISONum = 1.1.2
INSERT INTO TrainingRecords ( EmpNum, ISONum, TrainDate )
SELECT EmployeeInfo.EmpNum, ISORequirements.ISONum, Null AS Expr1
FROM EmployeeInfo INNER JOIN ISORequirements ON EmployeeInfo.JobNum = ISORequirements.JobNum
WHERE (((EmployeeInfo.EmpNum) Not In (SELECT Distinct EmployeeInfo.EmpNum
FROM (EmployeeInfo INNER JOIN TrainingRecords ON EmployeeInfo.EmpNum = TrainingRecords.EmpNum) INNER JOIN ISORequirements ON (ISORequirements.ISONum = TrainingRecords.ISONum) AND (EmployeeInfo.JobNum = ISORequirements.JobNum))));
TIA