你会怎么做使用JPA查询语言以下?

select * from person where email in
(select email from person group by email having count(email)>1)
有帮助吗?

解决方案

最后找到了解决方案:

select p from Person p
where p.email in (
    select q.email
    from Person q
    group by q.email having count(q.email)>1)
order by p.email, p.id

其他提示

此链接,还有的一般结构的解释一个JPA SELECT查询:

SELECT ... FROM ...
[WHERE ...]
[GROUP BY ... [HAVING ...]]
[ORDER BY ...]
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top