Hi all!
I have this model:
Customer
{..
public virtual IList<Order> Orders { get; set; }
..}
Order
{..
public virtual IList<OrderItem> OrderItems { get; set; }
..}
OrderItem
{
public virtual Order Order { get; set; }
public virtual Product Product { get; set; }
public virtual decimal Price { get; set; }
public virtual int Quantity { get; set; }
}
Product
{..
public virtual IList<OrderItem> OrderItems { get; set; }
..}
I would like to select customers that have an order worth above some
ammount.
In SQL:
select distinct cust.* from [Customer] cust inner join [Order] ord on
ord.CustomerId = cust.Id
where
ord.Id in (
select A.Id
from
(select ord.Id as Id, SUM(oi.Price * oi.Quantity) as OrderAmmount
from [Order] ord inner join [OrderItem] oi on ord.Id = oi.OrderId
group by ord.Id) A
where A.OrderAmmount > @ammount
)
Can I do this in QueryOver?
Thank you for your help.
--
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.