Hi,
I have written a query that looks courses and the course sessions that occur in the next 'x' period. I have added a left outer join to the session enrolment table so that I can look at the number of enrolled students for any session - or courses that have no enrolments
This is ok - except I am returning a count of 1 for those sessions that have no enrolments. How can I get this to give me a 0 instead?
SQL looks like :
SELECT C.DESCR
, A.COURSE
, A.COURSE_START_DT
, A.COURSE_END_DT
, A.MIN_STUDENTS
, A.MAX_STUDENTS
, COUNT(*)
FROM CRSE_SESSN_TBL A LEFT OUTER JOIN TRN_ENROLL_VW B ON A.COURSE = B.COURSE AND A.SESSION_NBR = B.SESSION_NBR
, COURSE_TBL C
WHERE A.COURSE_START_DT BETWEEN SYSDATE AND '2006-12-31'
AND A.COURSE = C.COURSE
GROUP BY C.DESCR, A.COURSE, A.COURSE_START_DT, A.COURSE_END_DT, A.MIN_STUDENTS, A.MAX_STUDENTS
The Count(*) returns a 1.
Any ideas?
Thanks
I have written a query that looks courses and the course sessions that occur in the next 'x' period. I have added a left outer join to the session enrolment table so that I can look at the number of enrolled students for any session - or courses that have no enrolments
This is ok - except I am returning a count of 1 for those sessions that have no enrolments. How can I get this to give me a 0 instead?
SQL looks like :
SELECT C.DESCR
, A.COURSE
, A.COURSE_START_DT
, A.COURSE_END_DT
, A.MIN_STUDENTS
, A.MAX_STUDENTS
, COUNT(*)
FROM CRSE_SESSN_TBL A LEFT OUTER JOIN TRN_ENROLL_VW B ON A.COURSE = B.COURSE AND A.SESSION_NBR = B.SESSION_NBR
, COURSE_TBL C
WHERE A.COURSE_START_DT BETWEEN SYSDATE AND '2006-12-31'
AND A.COURSE = C.COURSE
GROUP BY C.DESCR, A.COURSE, A.COURSE_START_DT, A.COURSE_END_DT, A.MIN_STUDENTS, A.MAX_STUDENTS
The Count(*) returns a 1.
Any ideas?
Thanks