Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Second highest value
select max(invoicedate)
from myview
union
select invoicedate
from myview
where invoicedate < (select max(invoicedate)
from myview)and rownum = 1;
raorg_at_my-deja.com wrote:
> Hi all,
> I have a view:
> dealid,
> customerid,
> accountid,
> invoicedate,
> invoicenum,
>
> For group of dealid, customerid, accountid, How can I get the max
> invoicedate and the second highest invoice date value. preferably in
> one query, but two will definitely help.
>
> Thanks,
> Rajesh.
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
Received on Sat Aug 07 1999 - 07:40:32 CDT
![]() |
![]() |