View previous topic :: View next topic
|
Author |
Message |
kumara.kranthi
New User
Joined: 03 Nov 2006 Posts: 21
|
|
|
|
Hi All,
Am currently using DB2V7. I have to get the row numbers. Non of OLAP functions supports.Could you please somebody suggest or give sample query to fetch rows between 200 to 500.
Thanks for yours help!! |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
please, someone help!
I have the same problem.
don't know how to access row number 883. |
|
Back to top |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
Try this ... not sure whether this will work or not ... pls try and let us know ..
Code: |
SELECT NAME, ROW# FROM SESSION.EMP TB1,
TABLE (SELECT COUNT(*)+1 AS ROW# FROM SESSION.EMP TB2 WHERE TB2.NAME < TB1.NAME) AS TEMP WHERE ROW# BETWEEN 200 AND 500;
|
|
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
what do rows from 200 to 500 have that makes them so interesting
and not those, let' s say, from 564 to 864 ?
in db2 the row number does not carry any intrinsic meaning..
if You unload and reload the table You might get different results
and that' s not a good application behavior,
processes should be repeatable and predictable |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I have to get the row numbers. . .
query to fetch rows between 200 to 500 |
Of what use would these be? If you run the query 4 days in a row, you would most likely get 4 different sets of result rows.
If you better describe what you need to do, we may be able to offer better suggestions.
FWIW, in the database world, there is no nth row concept.
How is this related to OLAP? |
|
Back to top |
|
|
kumara.kranthi
New User
Joined: 03 Nov 2006 Posts: 21
|
|
|
|
Actually my requirement is to get the row numbers..so that i can display the in between rows on my jsp page..suppose i have 1000 rows.than i shold be able to display the rows in between 1 to 100 or 200 to 300 like that.Sorry i have not mentioed my requirement clearly.
For Example : If we are going to take Google , i the down we are getting page number like 1,2,3,4,5,6..etc,if we select 1 we get some rows say 1 to 25 again we select 2 we get 26 to 50.
Now i need DB2 query to fullfill this requirement.
Please Do the needfull.
Thanks,
Kranthi |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
the row number is a value contained in a column??????? |
|
Back to top |
|
|
|