【发布时间】:2010-10-29 21:07:38
【问题描述】:
大家好,我有以下查询,我似乎无法将其翻译成 JPQL。工作 SQL 是:
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
我的翻译尝试如下:
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
提前感谢您可以发光的任何光!
【问题讨论】:
标签: java jpa aggregate-functions eclipselink jpql