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

Home -> Community -> Usenet -> c.d.o.server -> Re: top N or rewriting MAX

Re: top N or rewriting MAX

From: Komix Hui <huikomix_at_dt.com.hk>
Date: 1997/01/15
Message-ID: <32DD848D.2541@dt.com.hk>#1/1

AWILSON wrote:
>
> otierney_at_freenet.edmonton.ab.ca wrote:
> >
> > Does anyone know of good (ie FAST) ways of getting the top
> > N rows in a table?
> >
>
> Create a view on the distinct value of the column required (to get the
> sequence), then select from the viewname where rownum < n+1;

SQL Statement in view definition is a subquery, that means that an 'ORDER BY' cannot
appears in the view's definition. So your solution is wrong.

-- 
Hui, Kwok Miu (Xu, Guo Miao)         E-Mail: huikomix_at_dt.com.hk
Assistant MIS Manager                Tel   : (00852)2589 3369
Cho Yang (Hong Kong) Co., Ltd.       Fax   : (00852)2559 3049
Received on Wed Jan 15 1997 - 00:00:00 CST

Original text of this message

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