您将如何使用JPA查询语言执行以下操作?
select * from person where email in
(select email from person group by email having count(email)>1)
答案 0 :(得分:8)
终于找到了解决方案:
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
答案 1 :(得分:3)
从this link开始,解释了JPA SELECT Query的一般结构:
SELECT ... FROM ...
[WHERE ...]
[GROUP BY ... [HAVING ...]]
[ORDER BY ...]