Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: how can I get the second highest data?
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