|
I am trying to figure out a query that needs to display rows of grouped data based on max values of two columns. Here is an example. Fname lname age salary ---------- --------- ---- -------- John Smith 39 20000 John Smith 38 20000 John Smith 40 15000 Adam Apple 20 25000 Adam Apple 21 25000 Adam Apple 19 18000 I need to return one line from each group (one john smith and one Adam Apple) based on highest salary and age. For john Smith, highest Salary is 20000 and then highest age is 39, so the row returned would be John Smith 39 20000. For Adam Apple it would be Adam Apple 21 25000. I can get it narrowed down to rows grouped with highest salary, but then I can not think how to get it to narrow it down another level and only display the one with the larger age number after that. John A Candidi Rutgers Insurance Companies IT Director - Iseries Manager 856-779-2274
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.