Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How fo you return the SECOND highest record?

Re: How fo you return the SECOND highest record?

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Fri, 22 Dec 2000 08:07:34 -0000
Message-ID: <977472428.225.0.nnrp-10.9e984b29@news.demon.co.uk>

If you have Oracle 8.1.6, look at rank(). There is an article on my website about
analytic functions that explains how to
use this, and other, analytic, functions.

Featured -> Analytics

--
Jonathan Lewis
Yet another Oracle-related web site:  http://www.jlcomp.demon.co.uk

Practical Oracle 8i:  Building Efficient Databases

Publishers:  Addison-Wesley
See a first review at:
http://www.ixora.com.au/resources/index.htm#practical_8i
More reviews at: http://www.jlcomp.demon.co.uk/book_rev.html



Paul Druker wrote in message ...

>You may try something like
>
>select * from <table_name> where datetime < (select max(datetime) from
><table_name>);
>
>HTH,
>Paul
>
><vivarin_at_my-deja.com> wrote in message news:91uad8$6qm$1_at_nnrp1.deja.com...
>> I am stumped and would appreciate it if anyone
>> could help me. Perhaps the answer is obvious.
>> Anyways, I have a table with 3 columns like so:
>>
>> 1. (numeric unique key) PK
>> 2. (dateime) DATE
>> 3. (number) NUM
>>
>> The 3rd column, is NOT unique.
>>
>> Anyways, I want to return all recordsets that
>> have the second most recent DATE grouped by NUM,
>> as opposed to the most recent date. I've tried
>> various ways to join a table to itself but I'm
>> finding myself running into syntactical
>> difficulties. I know you can use a subquery with
>> a NOT IN clause, but I want to avoid that, and
>> perhaps use an outer join. Anyways, any help
>> would definitely be appreciated!!! Thanks
>>
>> JJY
>>
>>
>> Sent via Deja.com
>> http://www.deja.com/
>
>
Received on Fri Dec 22 2000 - 02:07:34 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US