我是 HQL 的新手,我正在尝试这样做:
select count(T) from (
select inscription, max(wrd_step) as max
from table aa
where rd_context = ?
group by inscription
) as T
where T.max = ?
错误是:
Caused by: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: ( near line 1, column 21 [select count(T) from( select inscription, max(wrd_step) from table aa where rd_context = ? group by inscription) as T where T.max = ?]
谢谢
编辑 :
HQL 中的查询是:
SELECT count(distinct inscription)
FROM Entity
WHERE inscription in (
select distinct inscription
from Entity
where rd_context = ?
group by inscription
having max(wrd_step) = ?
)