... INNER JOIN smagic!termcourse ; ON Attendance.crsschedid = Termcourse.crsschedid ; AND Termcourse.crsschedid = ( ?vp_crsschedid ); ...>>Make sure you've indexes on all fields used in JOINs. Quick loock revealed that you don't have indexes in the Termcourse table for following joins
... >> ON Termcourse.roomid = Roomslist.roomid ; >> INNER JOIN smagic!schedulehours ; >> ON Termcourse.hourid = Schedulehours.hourid ; >> INNER JOIN smagic!teacherlist ; >> ON Termcourse.teacherid = Teacherlist.teacherid; >>... >>>
>>>Joining table schedulehours and table termcourse (Cartesian product) >>>Joining intermediate result and table roomslist (Cartesian product) >>>Joining intermediate result and table programlist (Cartesian product) >>>Joining intermediate result and table teacherlist (Cartesian product) >>>Joining intermediate result and table courses (Cartesian product) >>>Joining intermediate result and table courselist (Cartesian product) >>>Joining intermediate result and table enroll (Cartesian product) >>>Joining intermediate result and table attendance (Cartesian product) >>>Joining intermediate result and table person (Cartesian product) >>these Cartesian joins. The WHERE Termcourse.crsschedid = (?vp_crsschedid) will filter it down to the 29 record result, so how do I make it evaluate the where clause early?