By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,162 Members | 1,018 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,162 IT Pros & Developers. It's quick & easy.

Find maximum value in one field per each group

P: n/a
I need a stored procedure or other method to find the maximum value
for each set of records. I would want to eliminate all of the non-
maximum records. An example of the data is below. For the example
below, I would want to return record 2,6,7, and 10. To pick between 7
and 8, I would want to pick the one with the minimum ID. Can anyone
supply some sample code? Note that some people may have only one
record.
ID Person Salary
1 44 20000
2 44 22000
3 44 21000
4 45 50000
5 45 51000
6 45 53000
7 46 45000
8 46 45000
9 46 40000
10 47 10000

Aug 4 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
http://www.mvps.org/access/queries/qry0020.htm

ar****@yahoo.com wrote:
I need a stored procedure or other method to find the maximum value
for each set of records. I would want to eliminate all of the non-
maximum records. An example of the data is below. For the example
below, I would want to return record 2,6,7, and 10. To pick between 7
and 8, I would want to pick the one with the minimum ID. Can anyone
supply some sample code? Note that some people may have only one
record.
ID Person Salary
1 44 20000
2 44 22000
3 44 21000
4 45 50000
5 45 51000
6 45 53000
7 46 45000
8 46 45000
9 46 40000
10 47 10000
Aug 4 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.