I am writing an query that determines which courses were held in large lecture halls or auditorium type classrooms in Summer Quarter of 2016.
When I execute it, it successfully filters for the Classroom Types of either Large Lecture or Audio but it doesn’t do the same for both Quarter and Year
Sample Output:
SELECT CO.CourseID, CourseName AS Summer2016LectureHallOrAudiotoriumCourses, ClassroomTypeName, QuarterName, [YEAR] FROM tblCOURSE CO JOIN tblCLASS C ON CO.CourseID = C.CourseID JOIN tblQUARTER Q ON C.QuarterID = Q.QuarterID JOIN tblCLASSROOM CR ON C.ClassroomID = CR.ClassroomID JOIN tblCLASSROOM_TYPE CT ON CR.ClassroomTypeID = CT.ClassroomTypeID WHERE CT.ClassroomTypeName = 'Large Lecture Hall' OR CT.ClassroomTypeName = 'Auditorium' AND Q.QuarterName = 'summer' AND C.[YEAR] = '2016'
Advertisement
Answer
Replace following in your query.
CT.ClassroomTypeName = 'Large Lecture Hall' OR CT.ClassroomTypeName = 'Auditorium'
with
(CT.ClassroomTypeName = 'Large Lecture Hall' OR CT.ClassroomTypeName = 'Auditorium')