Hi
I am running a query from the tables below and as well as needing to count all the 'pu.Unit_Instance_codes' (enrolments) I need to count the distinct 'UNIT_INSTANCES' (courses) but no matter what joins I use I am only getting the number of 'UNIT_INSTANCES' (courses) where there are enrolments and not the courses without.
Count(Distinct pu.UNIT_INSTANCE_CODE) Courses
,count(pu.PERSON_CODE) Total_Enrolments
FROM
PEOPLE p
INNER JOIN PEOPLE_UNITS pu
ON p.PERSON_CODE = pu.PERSON_CODE
Right JOIN UNIT_INSTANCE_OCCURRENCES uio
ON pu.UIO_ID = uio.UIO_ID
RIGHT JOIN UNIT_INSTANCES ui
ON pu.UNIT_INSTANCE_CODE = ui.FES_UNIT_INSTANCE_CODE
I am running a query from the tables below and as well as needing to count all the 'pu.Unit_Instance_codes' (enrolments) I need to count the distinct 'UNIT_INSTANCES' (courses) but no matter what joins I use I am only getting the number of 'UNIT_INSTANCES' (courses) where there are enrolments and not the courses without.
Count(Distinct pu.UNIT_INSTANCE_CODE) Courses
,count(pu.PERSON_CODE) Total_Enrolments
FROM
PEOPLE p
INNER JOIN PEOPLE_UNITS pu
ON p.PERSON_CODE = pu.PERSON_CODE
Right JOIN UNIT_INSTANCE_OCCURRENCES uio
ON pu.UIO_ID = uio.UIO_ID
RIGHT JOIN UNIT_INSTANCES ui
ON pu.UNIT_INSTANCE_CODE = ui.FES_UNIT_INSTANCE_CODE