Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Help with SQL Statement
Try this,
SELECT * FROM
(
SELECT /*+ RULE */ T.*, ROWNUM ROWCOUNT FROM TABLE1 T, DUAL D WHERE T.COL2
= D.DUMMY(+) AND ROWNUM <= 20
)
WHERE ROWCOUNT BETWEEN 10 AND 20
HTH,
Philippe
yitbsal_at_statcan.ca wrote in message <78kt20$332$1_at_nnrp1.dejanews.com>...
>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
Received on Wed Jan 27 1999 - 00:00:00 CST