Hi,
Given a simple schema e.g. PurchaseOrders { OrderId, Total, LineItemCount }, I want to generate a simple query for some simple stats like below:
select sum(lineitemcount) as totalitems, sum(total) as totalsales
from purchaseorders
However in Linq to Sql I am struggling to get this into one query.
At the moment I have this:
decimal totalSales = PurchaseOrders.Sum(po => po.Total)
decimal totalItems = PurchaseOrders.Sum(po => po.LineItemcount)
Is there a way to do this as one query?