Hi,
I'm having trouble with a tricky aggregate HQL query.
I am querying for Item records that have collections of Keyword. I would like to count the total number of keywords found across the set of Item objects found.
My standard query looks like..
"from Item a join a.keywords k where a.title like ? or a.description like ?"
I want to return something like..
"select k.name, count(k)"
And presumably I need a group by..
"group by k.keywordId order by count(k) ASC"
But count(k) is always 1 at the moment. Presumably I am getting the count of number of keywords in each Item rather than number of keywords over the total set.
Can anyone point me in the right direction?
Regards,
Damon.
|