SQL到HQL的问题

时间:2011-02-06 13:30:35

标签: java sql hibernate hql

我想在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;

1 个答案:

答案 0 :(得分:0)

不直接回答您的问题,但您可以简化查询。您可以使用having子句删除子查询:

select user_id as users
from score
group by user_id
having sum(score) = 5225

也许这有助于满足Hibernate。