2011-02-06 56 views
1

我想在HQL中編寫這個查詢,但我不能。 whatevere我這樣做似乎是錯誤的,休眠拋出異常。你可以幫我嗎?SQL到HQL問題

select t.users from (select user_id as users,sum(score) as total from score group by user_id) t where t.total=5225; 
+4

你嘗試了什麼,你得到了什麼異常? – 2011-02-06 13:36:25

回答

0

不直接回答你的問題,但可以簡化你的查詢。您可以通過使用having條款擺脫子查詢:

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

也許這有助於滿足休眠。