Re: Help with ROW_COUNT()

From: mrbaker001 <noreply_at_nowhere.com>
Date: Thu, 22 Feb 2001 01:41:40 -0000
Message-ID: <U4_k6.76921$Nw6.245730_at_NewsReader>


Don't you need a dummy "group by" on the primary key of the in line view to ensure the 5th row retrieved is always the 5th pkey value?

"Dorfmaxl" <Dorfer.Markus_at_surfeu.at> wrote in message news:hrQW5.37155$4d1.1899464_at_news.chello.at...
> Sorry, a comma is missing:
>
> select * from
> (select rownum rownum_alias, pkey, value from table1)
> where rownum_alias=5
>
>
> "Dorfmaxl" <Dorfer.Markus_at_surfeu.at> wrote in message
> news:dqQW5.37148$4d1.1898423_at_news.chello.at...
> > Hi !
> >
> > This should work:
> >
> > select * from
> > (select rownum rownum_alias pkey, value from table1)
> > where rownum_alias=5
> >
> > DM
> >
> > <sw_at_weinerfamily.org> wrote in message
> > news:3A2BB41B.12EA754D_at_weinerfamily.org...
> > > I need to find the 5th row in a selection, ordered by a value column.
> > > Since ROWNUM takes affect after the rownum is assigned it won't work.
> > > So I tried using ROW_NUMBER(). However the following query doesn't
> > > work:
> > >
> > > SELECT pkey, value,
> > > ROW_NUMBER() over (ORDER BY value ASC NULLS LAST) AS valcol
> > > FROM table1
> > > WHERE valcol = 3
> > >
> > >
> > >
> >
> >
>
>
>
Received on Thu Feb 22 2001 - 02:41:40 CET

Original text of this message