I am trying to pass a user supplied parameter at run time in crystal to a sybase anywhere runtime sql server. The statement used in the select expert formula wizard is:
{teacher.teacherid} = {?Teacher ID}
The sql query in "Show SQl" is:
This runs excruciatling slow coz it returns everything since I cannot reduce it down by passing a user supplied teacher id parameter.[/1]
SELECT DISTINCT
Teacher."Name",
Section."TeacherID", Section."CourseNum", Section."Section", Section."Period",
ScheduleTable."Deleted",
Course."Description",
Student."Deleted", Student."StudentID", Student."Name",
Attendance."Deleted", Attendance."AttendCode", Attendance."AttendDate"
FROM
{ oj (((("g2ds"."Teacher" Teacher INNER JOIN "g2ds"."Section" Section ON Teacher."TeacherID" = Section."TeacherID" INNER JOIN "g2ds"."Course" Course ON Section."CourseNum" = Course."CourseNum" INNER JOIN "g2ds"."ScheduleTable" ScheduleTable ON Section."CourseNum" = ScheduleTable."CourseNum" AND Section."Section" = ScheduleTable."Section" INNER JOIN "g2ds"."Attendance" Attendance ON ScheduleTable."StudentID" = Attendance."StudentID" AND ScheduleTable."CourseNum" = Attendance."CourseNum" AND ScheduleTable."Section" = Attendance."Section" LEFT OUTER JOIN "g2ds"."Student" Student ON Student."StudentID" = Attendance."StudentID"}
WHERE
Student."Deleted" = '0' AND ScheduleTable."Deleted" = '0' AND Attendance."Deleted" = '0'
ORDER BY
Teacher."Name" ASC, Section."Period" ASC, Student."Name" ASC
Need help, any ideas appreciated.
Thanks much,
Dave
{teacher.teacherid} = {?Teacher ID}
The sql query in "Show SQl" is:
This runs excruciatling slow coz it returns everything since I cannot reduce it down by passing a user supplied teacher id parameter.[/1]
SELECT DISTINCT
Teacher."Name",
Section."TeacherID", Section."CourseNum", Section."Section", Section."Period",
ScheduleTable."Deleted",
Course."Description",
Student."Deleted", Student."StudentID", Student."Name",
Attendance."Deleted", Attendance."AttendCode", Attendance."AttendDate"
FROM
{ oj (((("g2ds"."Teacher" Teacher INNER JOIN "g2ds"."Section" Section ON Teacher."TeacherID" = Section."TeacherID" INNER JOIN "g2ds"."Course" Course ON Section."CourseNum" = Course."CourseNum" INNER JOIN "g2ds"."ScheduleTable" ScheduleTable ON Section."CourseNum" = ScheduleTable."CourseNum" AND Section."Section" = ScheduleTable."Section" INNER JOIN "g2ds"."Attendance" Attendance ON ScheduleTable."StudentID" = Attendance."StudentID" AND ScheduleTable."CourseNum" = Attendance."CourseNum" AND ScheduleTable."Section" = Attendance."Section" LEFT OUTER JOIN "g2ds"."Student" Student ON Student."StudentID" = Attendance."StudentID"}
WHERE
Student."Deleted" = '0' AND ScheduleTable."Deleted" = '0' AND Attendance."Deleted" = '0'
ORDER BY
Teacher."Name" ASC, Section."Period" ASC, Student."Name" ASC
Need help, any ideas appreciated.
Thanks much,
Dave