I am working on my senior project which is a registration system and website. Everything works good, however I need to add that teachers can ONLY teach 3 classes. What I have now:
Some more information:
tblEmployee: emp_ID (key), can_Teach (topic can_Teach)
tblCourse: Course_ID (key), course_Type (topic to be taught - matches can_Teach above)
tblClass: Class_ID(key), emp_ID (FK), Course_ID (FK), sem_Time (Semester)
"SELECT * FROM tblEmployee, tblCourse WHERE tblEmployee.canTeach = tblCourse.course_Type AND course_ID = ?"
This will select a teacher that teaches a SPECIFIC COURSE. What I want to add to this is the capability to NOT select someone that already is teaching 3 classes (in tblClass). I have this actually set up very nicely in two drop down menus. The first is a listing of the topics, then based on their choice the second one is populated using the above query and inserted into the drop down list. I just want to exclude the ones that have 3 classes already. I figured out how to manually "remove" them in the listitems, and was almost thinking of doing a sub for that but this would be easier.
Based on emp_ID and sem_Time in tblClass
What I have tried:
"SELECT * FROM tblEmployee, tblCourse WHERE tblEmployee.canTeach = tblCourse.course_Type AND tblClass.course_ID = ? INNER JOIN (SELECT tblEmployee.emp_ID, tblClass.emp_ID FROM tblEmployee, tblClass GROUP BY tblClass.emp_ID having count(*) < 3 AND tblClass.emp_ID = tblEmployee.emp_ID)"