Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 3 way joins in a stored procedure

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-07-15 : 20:38:42
David writes "I am using the following stored procedure in my database. However, the query time is stil slow causing some problems with blocks. I would like to tune this a little better, but my experience and resources do not give me a path to success. Can you help? Thanks in advance.

Dave Tongay

CREATE PROCEDURE sp_get_user_course_test
@userId int,
@groupId int
AS

SELECT
cs.COURSE_SCHEDULE_ID,
cs.COURSE_SCHEDULE_ID,
co.TITLE,
co.SHORT_TITLE,
cs.START_DATE,
cs.END_DATE,
cr.COMPLETE_STATUS,
cr.STATUS as ROSTER_STATUS,
cs.STATUS as SCHEDULE_STATUS,
co.STATUS as OFFERING_STATUS,
co.COURSE_FAMILY_ID,
co.COURSE_OFFERING_ID,
co.DESCRIPTION,
co.SHORT_DESCRIPTION,
co.ENROLL_LIMIT
FROM
COURSE_ROSTER cr,
COURSE_SCHEDULE cs,
COURSE_OFFERING co
WHERE
cr.CUSTOMER_ID = @userId and
cr.COOURSE_SCHEDULE_ID = cs.COOURSE_SCHEDULE_ID and
cs.GROUP_ID = @groupId and
cs.COURSE_OFFERING_ID = co.COURSE_OFFERING_ID
ORDER BY
co.TITLE
"
   

- Advertisement -