select a.giftid,a.MaxOfgiftjntamt,b.gifteffdat
from
(
select giftid, Max(giftjntamt) AS MaxOfgiftjntamt
FROM gifts_VIEW
WHERE gifteffdat > '20050701'
AND giftacctdv in ('5','15')
and giftid = '0000054529'
) a
inner join gifts_VIEW b on a.giftid = b.giftid and a.MaxOfgiftjntamt = b.giftjntamt
I ran the query and got an error based on the giftID not contained in either aggregate or group by function. I added group by giftid and still get the error. I am trying to get the top or largest gift and the date associated with it
from
(
select giftid, Max(giftjntamt) AS MaxOfgiftjntamt
FROM gifts_VIEW
WHERE gifteffdat > '20050701'
AND giftacctdv in ('5','15')
and giftid = '0000054529'
) a
inner join gifts_VIEW b on a.giftid = b.giftid and a.MaxOfgiftjntamt = b.giftjntamt
I ran the query and got an error based on the giftID not contained in either aggregate or group by function. I added group by giftid and still get the error. I am trying to get the top or largest gift and the date associated with it