vwEmailJobVolunteerStats

Fields

Field Field Type Null Description
EmailJobID int
VolunteerTransactionsCount int yes

Definition

Copy

CREATE VIEW [dbo].[vwEmailJobVolunteerStats]
AS
    SELECT
        ej.[ID] As [EmailJobID],
        Count(vt.[ID]) As [VolunteerTransactionsCount]
    FROM 
        [dbo].[EmailJob] ej
    INNER JOIN [dbo].[EmailJob_Recipient] ejr
        ON ej.[ID] = ejr.[EmailJobID]
    INNER JOIN [dbo].[VolunteerTransactions] vt
        ON ejr.[ID] = vt.[EmailJobRecipientID]
    where vt.isdeleted = 0
    GROUP BY ej.[ID]