Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Lifetime value analysis
Message
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00682635
Message ID:
00682661
Vues:
14
Something like
SELECT AcctNum, SUM(Amount) AS Amount, 1997 AS year ;
  FROM mytable ;
  WHERE Year(GiftDate) = 1997 ;
   AND AcctNum NOT IN ( ;
      SELECT AcctNum FROM mytable ;
          WHERE Year(GiftDate) < 1997 ;
  GROUP BY AcctNum ;
  INTO CURSOR crsGift1997 NOFILTER

SELECT AcctNum, SUM(Amount) AS Amount, Year(GiftDate) AS year ;
  FROM mytable ;
  WHERE Year(GiftDate) > 1997 ;
   AND AcctNum IN ( ;
      SELECT AcctNum FROM crsGift1997 );
  GROUP BY AcctNum, Year ;
  INTO CURSOR crsGiftAfter NOFILTER

>I need to conduct what we call "lifetime value" analysis. I have a table that contains donation history of all donors for a non-profit organization. The field layout contains many fields but only fields of importance for this analysis are:
>
>AcctNum - acct# of the donor
>GiftDate - date a donation was given
>Amount - amount of donation
>
>Basically, I need to figure out how many and how much donation was received in 1997 that is considered to be "first gift" or donation from a new donor. Once determined, I need to track how much more donations were received from those same group for each subsequent years (1998, 1999, 2000, 2001).
>
>It seemed kind of easy when I was first told about doing the analysis but now I'm kind of at a loss where to start.
>
>1. I think I need to first determine the "first gifts" for 1997 but how?
>2. Then, I need to use the same set of data to match up for each subsequent years donations given by the same group.
>
>Is there an easy way to do this? Thanks.
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform