title: Trouble converting SQL Query into JPQL (Eclipselink)
body: <p>Hey guys,  I have the following query and for the life of me I can't seem to translate it into JPQL.  The working SQL is:</p>
  
  <pre><code>select * from TB_PRINT_DETAIL y inner join 
  (select JOB_ID,max(COPY_NUM) MAX_COPY_NUM from TB_PRINT_DETAIL  group by JOB_ID  ) x
  on y.JOB_ID = x.JOB_ID and y.COPY_NUM = x.MAX_COPY_NUM
  </code></pre>
  
  <p>My feeble attempt at translating it is as follows:</p>
  
  <pre><code>select o from PrintDetailEntity o inner join (select o2.jobId, max(o2.copyNumber) as
  maxCopyNum from PrintDetailEntity o2 group by o2.jobId ) as x on o.jobId = o2.jobId and
  o.copyNum = o2.maxCopyNum where o.printSuppressionReasonEntity is null
  </code></pre>
  
  <p>Thanks in advance for any light you can shine!</p>