Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Second highest value
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
![]() |
![]() |