select max(giftjntamt)as Amt,gifteffdat
from gifts with(nolock)
where gifteffdat >='7/1/1984'
and giftacctdv = '11'
and gifttype in ('c','g','y')
and giftid = '0ZU9531059'
group by giftid,gifteffdat
sample data
1000.00 1996-01-10 00:00:00.000
1500.00 1996-12-19 00:00:00.000
1500.00 1999-03-09 00:00:00.000
1500.00 2001-02-06 00:00:00.000
500.00 2002-12-26 00:00:00.000
desired output is the largest number and the accompanying date. Instead I get 5 separate amounts. $1500 is the largest amount.
Desired data
1500.00 2001-02-06 00:00:00.000
from gifts with(nolock)
where gifteffdat >='7/1/1984'
and giftacctdv = '11'
and gifttype in ('c','g','y')
and giftid = '0ZU9531059'
group by giftid,gifteffdat
sample data
1000.00 1996-01-10 00:00:00.000
1500.00 1996-12-19 00:00:00.000
1500.00 1999-03-09 00:00:00.000
1500.00 2001-02-06 00:00:00.000
500.00 2002-12-26 00:00:00.000
desired output is the largest number and the accompanying date. Instead I get 5 separate amounts. $1500 is the largest amount.
Desired data
1500.00 2001-02-06 00:00:00.000