select count(a.veces)
from
(
select count(id_product) as veces
from production_line
group by id_product
having count(id_product) > 2 and count(id_product) < 6
) as a
Query query = getCurrentSession().
createQuery("select count(a.veces) from
(select count(pl.idProduct) as veces from ProductionLine pl group by
pl.idProduct having count(pl.idProduct) > :mayor and count(pl.idProduct) < :menor) as a");
有人可以帮帮我吗?谢谢!引起:org.hibernate.hql.internal.ast.QuerySyntaxException
答案 0 :(得分:0)
为什么需要创建别名?尝试仅通过:
选择count(pl.idProduct)作为ProductionLine pl group by的veces pl.idProduct有计数(pl.idProduct)&gt; :mayor and count(pl.idProduct)&lt; :梅纳
创建查询方法