Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: top N or rewriting MAX
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 3049Received on Wed Jan 15 1997 - 00:00:00 CST