Last Gift Amount and Max Gift Date

Hello, 

I am working on some Output set elements for our Dev team and I have come a little stuck and I thought someone must have created these already...

I have managed to get the largest contribution amount but can't seem to get the corresponding date to output.

Also,

I have the last contribution date but not the amount. 

Thank you, 

Kelly

Parents Reply Children
  • Here is a view that will get you going. If need more let me know.

     

    USE [impresario]
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    create view [dbo].[lv_largest_gift]
    as

    /*****************************************************************************
    created 5/17/2011 tla
    select largest gift for output builder
    select * from lv_largest_gift
    ******************************************************************************/

    SELECT
    customer_no,
    max(cont_amt) as largest_cont_amt,
    max(cont_dt) AS largest_cont_amt_dt

    from t_contribution a

    Where a.cont_amt =(select max(cont_amt) from t_contribution b where a.customer_no = b.customer_no)

    GROUP BY a.customer_no


    GO
    grant select on [lv_largest_gift]  to impusers
    GO