My (simplified) domain model contains a many-to-many relationship
called Ownership between Customer and Product. I would like to write
an NHibernate HQL query that tallies the number of customers who own
each product (under certain criteria). Note that a customer can own a
given product multiple times, but this should only count as one "vote"
for that product.
The SQL for this is easy enough:
select ProductID, count(*)
from (
select distinct CustomerID, ProductID
from Ownership
where ...
) tbl
group by ProductID
Unfortunately, HQL does not support subqueries in the from clause. How
can I express this query in HQL?
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.