我想在HQL中编写此查询,但我不能。 whatevere我这样做似乎是错误的,而且hibernate会抛出异常。你能帮我吗?
select t.users from (select user_id as users,sum(score) as total from score group by user_id ) t where t.total=5225;
答案 0 :(得分:0)
不直接回答您的问题,但您可以简化查询。您可以使用having
子句删除子查询:
select user_id as users
from score
group by user_id
having sum(score) = 5225
也许这有助于满足Hibernate。