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: SQL problem

Re: SQL problem

From: Daniel A. Morgan <dmorgan_at_exesolutions.com>
Date: Thu, 28 Jun 2001 21:08:50 -0700
Message-ID: <3B3BFF52.79D490C8@exesolutions.com>

Doug O'Leary wrote:

> In article <9hfra1$cme$1_at_goodnews.ijs.si>, rok.kodrun_at_uni-lj.si says...
> >
> >I tried with embedded select with ROWNUM and COUNT and so on but failed to
> >get right records, because you can not order in embeded SELECT.
>
> You are correct; but you can order a view, then get a select number of
> rows that.
>
> I'm not sure of your table structure, or I'd be able to show you real
> queries; however, this should get you started:
>
> create or replace view view_name
> as select log, time, tekst
> from log
> order by time desc;
>
> select * from view_name
> where rownum < 8;
>
> << Displays 8 records in descending time order>>
>
> HTH;
>
> Doug
>
> --
> -------------------
> Douglas K. O'Leary
> Senior System Administrator
> dkoleary_at_mediaone.net

Since when can you use ORDER BY in a view? Unless that is a brand new feature I would suggest a SELECT from a SELECT.

Daniel A. Morgan Received on Thu Jun 28 2001 - 23:08:50 CDT

Original text of this message

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