[英]Spring Data JPA Select Distinct Column Pageable
我想 select 基于非 null 的列的不同记录并返回一个页面。 以下是抛出 java.sql.SQLSyntaxErrorException: ORA-01791: not a SELECTed expression。
(如果我能让这个工作,我想 select 与其他几列不同。)
@Query(value="SELECT DISTINCT pm.batchId from PrintManifest pm",
// + "where pm.batchId is not null"
countQuery = "select count(DISTINCT pm.batchId) from PrintManifest pm",
nativeQuery = true
)
Page<PolicyPrintManifest> findDistinctBatchId(Pageable pageable);
我也试过没有运气:
Page<PolicyPrintManifest> findDistinctByBatchIdExists(Pageable pageable);
执行此查询的正确方法是什么?
是表或实体的 PrintManifest 名称。 请记住,在本机查询中,您必须使用表名而不是实体名
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.