我遇到以下HQL查询的问题:
select sum(MYTABLE.COUNTER) from (
select count(DISTINCT bi.products.id) as COUNTER
from BusinessInformation as bi
where bi.informationOwners.id in (100)
and bi.products.id in (10)
and bi.valueAmount not in ('NA')
and ((bi.valueType = 'ACHIEVED' and bi.referenceYears.id = 1) or (bi.valueType = 'FINAL_BALANCE' and bi.referenceYears.id = 2))
group by bi.informationOwners.id
) MYTABLE
编译器报告:
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: ( near line 1, column 34
你知道查询有什么问题吗?我测试了内部查询,它工作正常。
谢谢, ç