tags:

views:

48

answers:

1

Hi, Is there a way to implement paging logic in DB2 SQL, where records can be fetched page wise. The following query works only for queries with no joins. When queries with join are used the ROW_NUM is returned as 0 and paging cannot be done.

SELECT * FROM (SELECT ROWNUMBER() OVER() AS ROW_NUM, Results.* FROM (SELECT * FROM Table1 ) AS Results) AS PagedResults WHERE PagedResults.ROW_NUM>0 AND PagedResults.ROW_NUM<=10

Thanks in advance