I take it back, DISTINCT would not work, but it could be done if that's what you want.
On Tue, Nov 11, 2008 at 1:10 PM, Michael Moore <[EMAIL PROTECTED]>wrote: > This assumes that if you had > TOM 1 > TOM 1 > TOM 2 > you would want the answer to be 1. If you wanted the answer to be 2, you > would make the inner select be "SELECT DISTINCT' > Mike > > > On Tue, Nov 11, 2008 at 1:06 PM, Michael Moore <[EMAIL PROTECTED]>wrote: > >> SELECT person, RESULT >> FROM (SELECT person, RESULT, >> ROW_NUMBER () >> OVER (PARTITION BY person ORDER BY RESULT) RN >> RN = 2; >> >> Mike >> >> On Tue, Nov 11, 2008 at 12:17 PM, Vlad <[EMAIL PROTECTED]>wrote: >> >>> >>> If I have a table with two columns Person and Result that has many >>> values:- >>> >>> Person Result >>> Tom 1 >>> James 1 >>> Tom 2 >>> James 4 >>> Tom 6 >>> James 5 >>> >>> What query would I use to find the 2nd highest result each of the >>> people achieved? >>> >>> I.e. the result would be >>> >>> Tom 2 >>> James 4 >>> >>> TIA >>> >>> >>> >>> >>> >> > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Oracle PL/SQL" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Oracle-PLSQL?hl=en -~----------~----~----~----~------~----~------~--~---
