spNetGroupRelation_MemberCounts

Parameters

Parameter Parameter Type Mode Description
@NetAccountID int IN

Definition

Copy



    CREATE PROCEDURE [dbo].[spNetGroupRelation_MemberCounts]
    (
    @NetAccountID int
    )
    AS

    BEGIN

    DECLARE @Confirmed int
    DECLARE @PendingMyConfirmation int
    DECLARE @PendingGroupConfirmation int

    SELECT @Confirmed  = Count(ID)
    FROM [NetGroupRelation] a
    WHERE
    a.NetAccountID = @NetAccountID 
    AND 
    (a.BlockedID = 0 OR a.BlockedID IS NULL)
    AND
    a.Confirmation IN (1,2,3)


    SELECT @PendingGroupConfirmation = Count(ID)
    FROM [NetGroupRelation] 
    WHERE
    NetAccountID = @NetAccountID 
    AND 
    (BlockedID = 0 OR BlockedID IS NULL)
    AND
    Confirmation = 0


    SELECT @PendingMyConfirmation = Count(ID)
    FROM [NetGroupRelation] 
    WHERE
    NetAccountID = @NetAccountID 
    AND 
    (BlockedID = 0 OR BlockedID IS NULL)
    AND
    Confirmation = 4

    SELECT ISNULL(@Confirmed,0) 'Confirmed', ISNULL(@PendingMyConfirmation,0) 'PendingMyConfirmation', ISNULL(@PendingGroupConfirmation,0) 'PendingGroupConfirmation'

    END