P
Pato-chan
My nested query is giving me the Access 2003 error, "At most one record can
be returned by this subquery." So obviously I didn't choose the right kind
of nested subquery because I need to be able to return more than one record.
The purpose of the query is to find employees on crew 1 who are certified and
assigned to the Trim post from the set of employees who were not absent on
11/2/07. Because more than one employee might have been absent on 11/2/07, I
need to return more than one record. The SQL statement is as follows:
SELECT EEName
FROM (
SELECT DISTINCT Employees.[Employee Name] AS EEName,
EmployeeCertifications.SS AS EESS
FROM Assignments INNER JOIN (EmployeeCertifications INNER JOIN Employees ON
EmployeeCertifications.SS = Employees.SS) ON Assignments.AssignedEmployeeSS =
EmployeeCertifications.SS
WHERE (((Assignments.AssignmentStartDate)<= #11/2/2007#) AND
((Employees.EndDate) Is Null) AND ((EmployeeCertifications.Certification)=
'Trim') AND ((Assignments.AssignmentEndDate) Is Null) AND ((Employees.Crew)=
1) AND ((Assignments.Post)= 'Trim')) )
WHERE (
SELECT AbsencesTardies.SS AS AbsentEESS
FROM AbsencesTardies INNER JOIN Employees ON AbsencesTardies.SS =
Employees.SS
WHERE (((AbsencesTardies.[Date of Occurrence])= #11/2/2007#) AND
((AbsencesTardies.[Absent Hrs])>=8)) )<> [EESS]
be returned by this subquery." So obviously I didn't choose the right kind
of nested subquery because I need to be able to return more than one record.
The purpose of the query is to find employees on crew 1 who are certified and
assigned to the Trim post from the set of employees who were not absent on
11/2/07. Because more than one employee might have been absent on 11/2/07, I
need to return more than one record. The SQL statement is as follows:
SELECT EEName
FROM (
SELECT DISTINCT Employees.[Employee Name] AS EEName,
EmployeeCertifications.SS AS EESS
FROM Assignments INNER JOIN (EmployeeCertifications INNER JOIN Employees ON
EmployeeCertifications.SS = Employees.SS) ON Assignments.AssignedEmployeeSS =
EmployeeCertifications.SS
WHERE (((Assignments.AssignmentStartDate)<= #11/2/2007#) AND
((Employees.EndDate) Is Null) AND ((EmployeeCertifications.Certification)=
'Trim') AND ((Assignments.AssignmentEndDate) Is Null) AND ((Employees.Crew)=
1) AND ((Assignments.Post)= 'Trim')) )
WHERE (
SELECT AbsencesTardies.SS AS AbsentEESS
FROM AbsencesTardies INNER JOIN Employees ON AbsencesTardies.SS =
Employees.SS
WHERE (((AbsencesTardies.[Date of Occurrence])= #11/2/2007#) AND
((AbsencesTardies.[Absent Hrs])>=8)) )<> [EESS]