Extract Max amount's reccord from each customer

rizhaque

New Member
Joined
Jul 15, 2003
Messages
9
Need SQL that could pull only one record per customer with the highest amount.

Here is the table:

Last First Gift Date MaxAmount
James kim 17-Dec-02 $90.00 This record
James kim 23-Jan-96 $10.00
James kim 12-Feb-97 $9.00
weeks alen 01-May-99 $33,000.00 This record
weeks alen 02-Feb-92 $30,000.00
weeks alen 31-Dec-91 $27,000.00
Finkelstine Gail 25-Apr-89 $16,000.00 This record
Finkelstine Gail 27-Dec-96 $13,000.00
Finkelstine Gail 01-Apr-91 $12,000.00

Thanks,
 
Ok, then try this:
  • SELECT A.*, B.[GiftDate] FROM (Select LastName, FirstName, Max(MaxAmount) AS MaxAmt
    FROM Test
    GROUP BY LastName, FirstName) AS A, Test B
    WHERE A.LastName=B.LastName AND A.FirstName=B.FirstName and A.MaxAmt=B.MaxAmount;
Let me know if this one works.

-Russell
 
Upvote 0

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Forum statistics

Threads
1,221,545
Messages
6,160,446
Members
451,646
Latest member
mmix803

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top