• Hi Craig.

    It's ok. I now understand the code, and how it relates to the query overall.

    But I have a question... should be simple to answer.

    I have the following code ...

    SELECT DISTINCT su.StudentID,

    COUNT(su.QualificationCode) OVER (PARTITION BY su.StudentID) as QualsFound,

    COUNT(su.UnitCode) OVER (PARTITION BY su.StudentID) as UnitsFound

    FROM tblStudentUnitRegister su

    WHERE su.QualificationCode IS NOT NULL

    AND su.UnitCode IS NOT NULL

    What I am trying to do is report by each student ID, the number of Qualifications and Units.

    But as you may have already seen, it's reporting the same COUNT() for each.

    i.e.

    StudentIDQualsFoundUnitsFound

    TECNQ1313711

    TECNQ111056666

    ATCNQ080156868

    TECNQ120164646

    TECNQ12354128128

    TECNQ1309011

    TECNQ122654545

    TECNQ112011212

    How can I do the above but with DISTINCT in each COUNT() function?

    Thanks

    http://www.tecnq.com.au