title: JPQL for select from select row_number() over()
body: <p>I'm using Db2 on AS/400, and I am trying to execute a JPQL query that will return results from row x to row y.</p>
  
  <p>In SQL this works:</p>
  
  <pre><code>select cur.* from (
    SELECT ROW_NUMBER() OVER() AS ROWNUM FROM tableName d) as cur
  WHERE cur.ROWNUM &gt; 0 AND cur.ROWNUM &lt; 10
  </code></pre>
  
  <p>How can I do this in JQPL?  I tried it in many ways but every time I got an exception.</p>
  
  <p>I want to limit my result inside the query, and not by using the setMaxResult, setFirstResult methods.</p>