Vote count:
0
Below is the code that keeps giving me alias error:
SELECT name, semester FROM (SELECT name, semester, (SELECT COUNT(*) FROM instructors AS i JOIN teaches ON i.id = teaches.instructor_id JOIN schedules ON teaches.schedule_id = schedules.id JOIN sections AS s ON schedules.section_id = s.id WHERE i.name = instructors.name AND hour_start > 10 AND ( hour_end < 17 OR ( hour_end = 17 AND min_end <> 0 ) ) AND s.semester = sections.semester) AS c1, (SELECT COUNT(*) FROM instructors AS i2 JOIN teaches ON i2.id = teaches.instructor_id JOIN schedules ON teaches.schedule_id = schedules.id JOIN sections AS s2 ON schedules.section_id = s2.id WHERE i2.name = instructors.name AND s2.semester = sections.semester) AS c2 FROM instructors JOIN teaches ON instructors.id = teaches.instructor_id JOIN schedules ON teaches.schedule_id = schedules.id JOIN sections ON schedules.section_id = sections.id WHERE c1 = c2) GROUP BY name, semester ORDER BY name, semester;
Aucun commentaire:
Enregistrer un commentaire