UFN_SELECTION_CONSTITUENT_PROSPECTRESEARCHCONSTITUENTSWITHPROPERTIESINTRUST

Returns IDs of constituents who do not have wealth updates disabled and have a real estate record with an owner name or buyer name that contains 'trust'.

Return

Return Type
table

Definition

Copy


            CREATE function dbo.UFN_SELECTION_CONSTITUENT_PROSPECTRESEARCHCONSTITUENTSWITHPROPERTIESINTRUST()
            returns table
            as return
                select distinct
                    C.ID
                from dbo.CONSTITUENT C
                left join dbo.DISABLEDWEALTHUPDATES DWU on DWU.ID = C.ID
                left join dbo.WPREALESTATE RE on RE.WEALTHID = C.ID
                where
                    C.ISORGANIZATION = 0 and
                    DWU.ID is null and
                    (RE.OWNER like '%trust%' or
                    RE.BUYER like '%trust%');