V_QUERY_RE7_CONSTITUENTEVENTSUMMARY

Fields

Field Field Type Null Description
CONSTITUENT_LOCALID int
EVENTCOUNT int yes
FIRSTDATE datetime yes
LASTDATE datetime yes
YEARSSINCE int
MONTHSSINCE int
DAYSSINCE int
EVENTYEARS int yes
DISTINCTCYEARS int yes
DISTINCTFYEARS int yes

Definition

Copy
/*
Generated by Blackbaud AppFx Platform
Date:  2/6/2025 8:50:26 AM
Assembly Version:  Blackbaud.AppFx.Platform.SqlClr, Version=4.0.3901.0, Culture=neutral, PublicKeyToken=null
Copyright Blackbaud
*/
CREATE VIEW dbo.V_QUERY_RE7_CONSTITUENTEVENTSUMMARY AS



select
  [CONSTITUENT_LOCALID],
  [EVENTCOUNT],
  [FIRSTDATE],
  [LASTDATE],
  isnull(case when current_timestamp < dateadd(year, datediff(year, [LASTDATE], current_timestamp), [LASTDATE]) then datediff(year, [LASTDATE], current_timestamp) - 1 else datediff(year, [LASTDATE], current_timestamp) end,0) [YEARSSINCE],
  isnull(case when current_timestamp < dateadd(month, datediff(month, [LASTDATE], current_timestamp), [LASTDATE]) then datediff(month, [LASTDATE], current_timestamp) - 1 else datediff(month, [LASTDATE], current_timestamp) end,0) [MONTHSSINCE],
  isnull(datediff(dd, [LASTDATE], current_timestamp),0) [DAYSSINCE],
  [EVENTYEARS],
  [DISTINCTCYEARS],
  [DISTINCTFYEARS]
from [dbo].[RE7_CONSTITUENTLTEVENT]