UFN_SELECTION_CONSTITUENT_STUDENTS

Gets all constituents who are students.

Return

Return Type
table

Definition

Copy


            CREATE function dbo.UFN_SELECTION_CONSTITUENT_STUDENTS()
            returns table
            as return
                select distinct
                    CONSTITUENT.ID
                from
                    dbo.CONSTITUENT
                    inner join dbo.EDUCATIONALHISTORY on CONSTITUENT.ID = EDUCATIONALHISTORY.CONSTITUENTID
                    inner join dbo.EDUCATIONALINSTITUTION on EDUCATIONALHISTORY.EDUCATIONALINSTITUTIONID = EDUCATIONALINSTITUTION.ID and EDUCATIONALINSTITUTION.ISAFFILIATED = 1
                where
                    EDUCATIONALHISTORY.CONSTITUENCYSTATUSCODE = 1; /*Currently attending -- from EducationalHistory table*/