我正在使用spring data jpa 的Specification构建查询,但是遇到一个问题,如果我在查询的最后做group by 那查询出来的count值是不对的,查询SQL得到如以下结果:
select count(letter0_.id) as col_0_0_ from letter letter0_ where letter0_.status=1 and letter0_.owner=16 group by letter0_.global_key
很明显这个SQL是错得,我想要查询的是group by之后的所有列的count
...全文
3012打赏收藏
spring data jpa 分页查询分组
我正在使用spring data jpa 的Specification构建查询,但是遇到一个问题,如果我在查询的最后做group by 那查询出来的count值是不对的,查询SQL得到如以下结果: select count(letter0_.id) as col_0_0_ from letter letter0_ where letter0_.status=1 and letter0_.owner=16 group by letter0_.global_key 很明显这个SQL是错得,我想要查询