Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Q: How to select 20th to 100th rows?
Hi,
> > Say, I have a table with 1000 records in it. I have two numbers,
> > x = 25 and y = 250. I want to select the 26th. to 250th. rows of
> > this table.
> >
> > In SQL how can I do this without using a SEQUENCE column in the
> > table?
> select * from (select rownum seq, mytable.* from mytable)
> where seq between 25 and 250
> This assumes you don't care that the records are not ordered, you just
> want the 25th thru 250th as they come from the database.
And if you care of the order of records:
select t1.name_every_col
from
table_1 t1
,table_1 t2
where
t1.order_col >= t2.order_col
group by t1.name_every_col
having count(t2.rowid) between x and y
;
But this is quite expensive query!
Regards,
Jan
Received on Fri Aug 15 1997 - 00:00:00 CDT
![]() |
![]() |