I am trying to write a SQL query that basically takes the starting and ending values that have already been inserted for a particular day and compares them with all of the starting and ending values to output everything that doesn't conflict. In other words, I am writing a scheduling application, that should tell a person the courses that they cannot take due to a scheduling conflict. This is what I have right now:
SELECT C2.COURSENUM, C2.SECTIONID
FROM TIMES T2, CLASSES C2
WHERE T2.SECTIONID = C2.SECTIONID AND
(T2.MONSTART >=
(SELECT T.MONEND
FROM DEGAUDIT D, UNDERGRAD S, TIMES T, CLASSES C
WHERE D.SID = S.SID AND S.SSN = ? AND C.SECTIONID = T.SECTIONID
AND D.SECTIONID = C.SECTIONID)
OR T2.MONEND <=
(SELECT T.MONSTART
FROM DEGAUDIT D, UNDERGRAD S, TIMES T, CLASSES C
WHERE D.SID = S.SID AND S.SSN = ? AND
C.SECTIONID = T.SECTIONID
AND D.SECTIONID = C.SECTIONID))
Where MonStart and MonEnd are my starting and ending times respectively. Right now, I am having troubles because both subqueries return more than one value which you cannnot use with the <= symbol or the >= symbol. Is there a way to accomplish this task using IN or NOT IN? Thank you! Your help is greatly appreciated.
Aucun commentaire:
Enregistrer un commentaire