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
How to query range of data in DB2 with highest performance?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With