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

Home -> Community -> Usenet -> c.d.o.tools -> Re: how can I get the second highest data?

Re: how can I get the second highest data?

From: Frank <franjoe_at_frisurf.no>
Date: Wed, 8 Aug 2001 08:32:26 +0200
Message-ID: <h35c7.4930$e%4.153351@news3.oke.nextra.no>

Hi!

Could something like this be worth working on?(goes for O8i)

SELECT i.*
FROM (SELECT count(*) cnt, a.id, a.customer, RANK () OVER (ORDER BY count(*) DESC) rank FROM tableA a, tableB b
WHERE a.id=b.id
GROUP BY a.id, a.customer) i
WHERE rank=2
;

I don't know how this behaves with huge amount of data, possibly it is a sub-optimal solution,
but at least it gave me a chance to train on the analyze functions in Oracle8i
Frank Received on Wed Aug 08 2001 - 01:32:26 CDT

Original text of this message

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