UFN_SELECTION_CONSTITUENT_FIRSTTIMEDONORS

Returns all first time donor constituents.

Return

Return Type
table

Definition

Copy


        CREATE function dbo.UFN_SELECTION_CONSTITUENT_FIRSTTIMEDONORS()
        returns @IDS table (ID uniqueidentifier)
        as 
        begin
                insert into @IDS (ID)
                select REVENUE.CONSTITUENTID as ID 
                from dbo.REVENUE with (nolock)        
                where REVENUE.TRANSACTIONTYPECODE = 0
                and REVENUE.CONSTITUENTID is not null -- Altru allows revenue without donors

                group by REVENUE.CONSTITUENTID
                having count(*) = 1
            return
        end