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: fumi <fumi_at_tpts5.seed.net.tw>
Date: 10 Aug 1999 08:33:11 GMT
Message-ID: <7ooo47$16g$3@news.seed.net.tw>

<raorg_at_my-deja.com> wrote in message news:7ofdda$m8j$1_at_nnrp1.deja.com...
> 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.

select a.invoicedate
  from view_name a, view_name b
  where a.invoicedate<=b.invoicedate
  group by a.sal
  having count(distinct b.invoicedate)<=2; Received on Tue Aug 10 1999 - 03:33:11 CDT

Original text of this message

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