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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Second highest value

Re: Second highest value

From: Mike Heisz <mheisz_at_rim.net>
Date: Mon, 9 Aug 1999 14:35:48 -0400
Message-ID: <newscache$nnn7gf$zoo$1@njord.rim.net>


This should work and solve that problem: select max(invoicedate)
 from myview
 union
 select max(invoicedate)
 from myview
 where invoicedate < (select max(invoicedate)

                                    from myview);

Mike

<morris_minor_at_my-deja.com> wrote in message news:7on139$mh2$1_at_nnrp1.deja.com...
> In article <37AC2940.17BE63EC_at_Unforgettable.com>,
> BluesSax_at_Unforgettable.com wrote:
> > select max(invoicedate)
> > from myview
> > union
> > select invoicedate
> > from myview
> > where invoicedate < (select max(invoicedate)
> > from myview)
> > and rownum = 1;
> >
> Will this not just select, for the second value, simply the first
> record to come out of the database? Invoice date in this case is not
> guaranteed to be retrieved in date order, so it is not necessarily the
> second highest.
>
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
Received on Mon Aug 09 1999 - 13:35:48 CDT

Original text of this message

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