Hello,
I'm a newbie with hql and I've encoutered a problem. I know how to make an average of a count in Sql but I can't make it in Hql.
Here's an example :
An object Cat with a color and a name.
If I want the number of cats of each color, I can make :
Code:
select count(cat.color) from Cat cat group by cat.color
But now, I want the average number of cat by colors. May someone tell me how to do this.
It's kind of something like :
Code:
select avg(count) from (select count(cat.color) as count from Cat cat group by cat.color)
But in Hql, it's perfectly wrong...