hibernate inner select in from clause
I'd like to know if it's possible to specify a select clause in a from clause something like
select count(*) as Y, this_.NAME as A, sel2.C
from TABLE1 this_,
(select count(*) as C from
(select this_.NAME, this_.SEX
from TABLE1 this_ group开发者_如何转开发 by this_.NAME, this_.SEX) sel1
) sel2
group by this_.NAME, sel2.C;
I need a query like this in order to have the count number as an extra column in the outer query. I can't find out how to specify a select statement in a from, neither with hql nor with criteria.
Thank you.
Luca
According to Hibernate documentation HQL subqueries can occur only in the select or where clauses:
Hibernate Community Documentation, Chapter 16. HQL - 16.3. Subqueries
精彩评论