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

Home -> Community -> Usenet -> c.d.o.misc -> Re: a select data from a table - rownum alias

Re: a select data from a table - rownum alias

From: Steve McDaniels <steve.mcdaniels_at_sierra.com>
Date: Mon, 25 Oct 1999 12:24:10 -0700
Message-ID: <7v2atl$cqb$1@plo.sierra.com>


I had:
> > select * from
> > ( select rownum, A.* from worker A )
> > where rownum between 10 and 12
> > /

Correction (need to alias rownum)
 select * from ( select rownum R, A.* from worker A )  where R between 10 and 12
 /

Sarita Kumar <saritaak_at_Perigee.net> wrote in message news:7uqd82$rv4_at_enews3.newsguy.com...
> Hi,
> You are using rownum wrongly. ROWNUM is assigned to rows at the time of
out
> put. If your condition is "rownum < 5", its OK but if the condition is
> "rownum Between 10 and 15", u will get nothing because 1,2,3... have not
> been generated and condition can't be fullfilled.
>
> Alok
>
> Steve McDaniels <steve.mcdaniels_at_sierra.com> wrote in message
> news:7uo8eo$r08$1_at_plo.sierra.com...
> > select * from
> > ( select rownum, A.* from worker A )
> > where rownum between 10 and 12
> > /
> >
> > Jingyan <jingyan.xu_at_tst2000.com> wrote in message
> > news:YWqO3.582$7d2.14652_at_nuq-read.news.verio.net...
> > > Hi,
> > > 1.my a SQL statement is below.
> > > select * from worker
> > > where rownum between 10 and 12
> > > /
> > > When I run it, no rows select. in fact, worker table has 14 rows.
> > > If I run it like this:
> > > select * from worker
> > > where rownum between 1 and 12
> > > it selects 12 rows. I want to know why?
> > >
> > > 2. how to write a select statement to list the five oldest workers
from
> > the
> > > worker table.
> > > select * from (select * from worker order by age desc)
> > > where rownum < 6;
> > > above is my way, but it doesn't work on my compuer. please help me.
> > > Thanks in advance,
> > > Jingyan
> > >
> > >
> > >
> >
> >
>
>
Received on Mon Oct 25 1999 - 14:24:10 CDT

Original text of this message

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