UFN_TEAMFUNDRAISINGTEAM_GETTEAMFUNDRAISINGTEAMHISTORYTEAMS

Returns team history for a given team fundraising team. The given team is not included in the results.

Return

Return Type
table

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN

Definition

Copy


            CREATE function dbo.UFN_TEAMFUNDRAISINGTEAM_GETTEAMFUNDRAISINGTEAMHISTORYTEAMS
            (
                @ID uniqueidentifier
            )
            returns table
            as
            return
            (
                select
                    [TEAMHISTORY].APPEALID,
                    APPEAL.NAME [APPEALNAME],
                    EVENT.ID [EVENTID],
                    EVENT.NAME [EVENTNAME],
                    [TEAMHISTORY].ID [TEAMFUNDRAISINGTEAMID],
                    [TEAMHISTORY].NAME [TEAMFUNDRAISINGTEAMNAME],
                    [TEAMHISTORY].GOAL [TEAMGOAL],
                    APPEAL.STARTDATE [APPEALSTARTDATE],
                    APPEAL.BASECURRENCYID
                from
                    dbo.TEAMFUNDRAISINGTEAM
                    left join dbo.TEAMFUNDRAISINGTEAM [TEAMHISTORY] on TEAMFUNDRAISINGTEAM.TEAMFUNDRAISINGTEAMGROUPID = [TEAMHISTORY].TEAMFUNDRAISINGTEAMGROUPID
                    left join dbo.EVENT on [TEAMHISTORY].APPEALID = EVENT.APPEALID
                    left join dbo.APPEAL on [TEAMHISTORY].APPEALID = APPEAL.ID
                where
                    TEAMFUNDRAISINGTEAM.ID = @ID
                    and [TEAMHISTORY].ID <> @ID
                    and [TEAMHISTORY].ID is not null
            )