Re: [Q] Daves's top 10 SQL question
From: Yoram zilberberg <elric_dm_at_netvision.net.il>
Date: 1996/03/24
Message-ID: <NEWTNews.827736760.23046.elric_dm_at_dialup.netvision.net.il>#1/1
Date: 1996/03/24
Message-ID: <NEWTNews.827736760.23046.elric_dm_at_dialup.netvision.net.il>#1/1
here is a possible answer:
so you see, oracle will retreive all the rows (order by does that)
but you will get just the first ten.
how-ever, the real thing can be to define a cursor from that select
and tehn fetching just the first 10 (in Pro*C it will be just
one fetch, in Pl/Sql you'll have to work a bit harder)
good luck
Received on Sun Mar 24 1996 - 00:00:00 CET
select <column>[,<column>]
from table[,table]
where rownum < 11
order by <order_columns>
note that you can still use group by etc.