|
View previous topic :: View next topic
|
| Author |
Message |
ywheeler
New User
Joined: 10 Nov 2006 Posts: 19 Location: New York
|
|
|
|
I want to select from a table x-nbr of rows after skipping the first x-nbr of rows. Like this...
Select *
From db2table.abcd
skip first 10000 rows
fetch 1000 rows
;
Can this be done?
Thanks. |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10903 Location: italy
|
|
|
|
SKIPAFT
just curious... in what language did You find the SKIPAFT function ??? |
|
| Back to top |
|
 |
ywheeler
New User
Joined: 10 Nov 2006 Posts: 19 Location: New York
|
|
|
|
| SKIPAFT- Its either sort or fileaid I don't remember right now. |
|
| Back to top |
|
 |
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
at minimum you would need an "order by"
without order by the first n rows is meaningless.
In Spufi/qmf
| Code: |
select * from
(select T.*,row_number() over (order by col1) as rn from table1 T) A
where rn between 10001 and 11001 |
or if you don't want to order by
| Code: |
select * from
(select T.*,row_number() over (order by 1) as rn from table1 T) A
where rn between 10001 and 11001 |
In an application program I would use "scrollable cursors" |
|
| Back to top |
|
 |
|
|