Using a custom join with summing in ServiceStack.OrmLite

501 Views Asked by At

I haven't found any example that allows for something like the following...

select
    o.*,
    total.OrderTotal
from Orders o
join
    (select OrderId,sum(ProductCost) as OrderTotal from OrderItems group by OrderId) total on o.OrderId=total.OrderId

I was able to get around it by putting the sum into a custom select column, but that avenue failed once I wanted to add the ability to filter the results by OrderTotal which can be done in the above by adding a having sum(ProductCost)>??.

Is this possible without doing straight custom SQL?

0

There are 0 best solutions below