psycoperl
Active Member
- Joined
- Oct 23, 2007
- Messages
- 339
- Office Version
- 365
- 2016
- Platform
- Windows
- MacOS
- Web
Need some guidance/advice:
When I am running this query, I am getting "The multi-valued field 'Seats.tsTestTypes' is not valid in the specified JOIN Clause"
In my tblTestSessions.tsTestTypes I have the list of all the TestCodes that can be issued for that session.
I am trying to get a list of the sessions that have seats available and are in the future.
HELP!
When I am running this query, I am getting "The multi-valued field 'Seats.tsTestTypes' is not valid in the specified JOIN Clause"
In my tblTestSessions.tsTestTypes I have the list of all the TestCodes that can be issued for that session.
I am trying to get a list of the sessions that have seats available and are in the future.
HELP!
Code:
SELECT
Seats.tsTestSessionID,
Seats.tsTestSessionDateTime,
Seats.SeatsAvailable
FROM
(SELECT
tblTestSessions.tsTestSessionID,
tblTestSessions.tsTestTypes,
tblTestSessions.tsTestSessionDateTime,
tblTestSessions.tsMaxRegistration,
tblTestSessions.tsMaxRegistrationOverride,
tblTestSessions.tsRoom,
IIf(IsNull([APT].[NumOfAppt]),0,[APT].[NumOfAppt]) AS NumOfAppt,
tblTestSessions.tsMaxRegistration-IIf(IsNull([APT].[NumOfAppt]),0,[APT].[NumOfAppt]) AS SeatsAvailable
FROM tblTestSessions LEFT JOIN
(SELECT
tblStudentAppointments.aptSession,
Count(tblStudentAppointments.aptRecordID) AS NumOfAppt
FROM tblStudentAppointments
GROUP BY tblStudentAppointments.aptSession) AS APT
ON tblTestSessions.tsTestSessionID = APT.aptSession) AS SEATS INNER JOIN
(SELECT
STN.*
FROM tblStudentTestNeeds AS STN INNER JOIN
(SELECT
tblStudentTestNeeds.tnStudentID,
Max(tblStudentTestNeeds.tnDateEntered) AS MaxOftnDateEntered
FROM tblStudentTestNeeds
GROUP BY tblStudentTestNeeds.tnStudentID) AS MRTC
ON (STN.tnDateEntered = MRTC.MaxOftnDateEntered)
AND (STN.tnStudentID = MRTC.tnStudentID)) As NEEDS
ON NEEDS.tnTestCode = Seats.tsTestTypes
WHERE
Seats.tsTestSessionDateTime > now()
AND
Seats.SeatsAvailable > (-1*Seats.tsMaxRegistrationOverride)