title: implementing paging logic in DB2 SQL
body: <p>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.</p>
  
  <pre><code>SELECT * FROM (SELECT ROWNUMBER() OVER() AS ROW_NUM, Results.*
                           FROM (SELECT * FROM Table1 ) AS Results) AS PagedResults
  WHERE PagedResults.ROW_NUM&gt;0 AND PagedResults.ROW_NUM&lt;=10
  </code></pre>
  
  <p>Thanks in advance</p>