gpt4 book ai didi

java - 在 JPA 查询中使用 group by 和 having

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:43:26 25 4
gpt4 key购买 nike

您将如何使用 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

关于java - 在 JPA 查询中使用 group by 和 having,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3439910/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com