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: Help with SQL Statement

Re: Help with SQL Statement

From: <frank_delisle_at_hotmail.com>
Date: 1999/01/27
Message-ID: <78neh9$5ou$1@nnrp1.dejanews.com>#1/1

try the pseudocolumn ROWNUM which will return the number(rank) of the column.  so you query would be something like:

> select *
> from table1 a
> where rownum between 10 and 20
> order by a.col2;

In article <78kt20$332$1_at_nnrp1.dejanews.com>,   yitbsal_at_statcan.ca wrote:
> Hi,
>
> I am trying to get the tenth record as ordered by col2. The following SQL
> statement returns errors on parsing:
>
> select *
> from table1 a
> where 10 =
> (select count(*)
> from table1 b
> where a.col2 >= b.col2);
>
> Substituting the 'in' operator for the '=' works. However, I have a more
> general problem. I'd like to say:
>
> select *
> from table1 a
> where (10,..,20)
> (select count(*)
> from table1 b
> where a.col2 >= b.col2);
>
> That is, I want to get the records from position 10 through 20, as ordered by
> col2. This does not work, and I don't see a workaround.
>
> Help?!
>
> Thanks,
> Salaam Yitbarek
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
>

Frank Delisle
Consultant, Eds Québec
e-mail: francois.delisle_at_prosig.qc.ca
"Un problème sans solution n'est pas un problème"

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Wed Jan 27 1999 - 00:00:00 CST

Original text of this message

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