Given a simple circuit, for example. PurchaseOrders {OrderId, Total, LineItemCount}, I want to create a simple query for some simple characteristics, as shown below:
select sum(lineitemcount) as totalitems, sum(total) as totalsales
from purchaseorders
However, in Linq to Sql, I am trying to get this in a single 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 a single request?
source
share