Following is the query to do this in Oracle. What is the equivalent in db2?
==================================================================
SELECT *
FROM
(select inner.*, rownum rnum
from
(SELECT s.tableA_id xyz0, s.crtd_dtt xyz1,
s.tableA_id xyz2, s.tableA_id
xyz3, s.tableA_num xyz4, s.tableA_desc xyz5,
s.cur_optlstat_id xyz6, s.display_status xyz7 FROM tableA_t s
WHERE 1 = 1
AND s.tableA_id > '65185'
AND s.display_status = 5005
order by s.crtd_dtt desc, s.tableA_id) inner
where rownum < 100)
WHERE rnum >= 37
==================================================================
Thanks,
-Jane
I would do it like this:
SELECT *
FROM ( SELECT ...,
row_number() over(order by s.crtd_dtt desc, s.tableA_id)
FROM tableA_t s
WHERE s.tableA_id > '65185' AND
s.display_status = 5005 ) AS inner(..., rnum)
WHERE rnum BETWEEN 37 AND 99
--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Thanks for the response. Does this type of query perform well? We
have Web application and we are going to use this type of query to
allow users to jump pages. The tables will have over 5 million
records.
Thanks,
-Jane
Just for starters, you need to explain what indexes you have on the table(s)
accessed before and estimate of query performance can be determined.