[dba-VB] Using aggregate SQL functions (Count(). Max(), ...) in ADO.NET EF queries in .NET Framework

Gustav Brock Gustav at cactus.dk
Fri Jun 25 11:24:04 CDT 2010

Hi Shamil

I have nothing running at the moment on this computer, but isn't it similar to this (from examples in LinqPad):

For example, the following query will work on the NORTHWND sample database:

from p in Products
let spanishOrders = p.OrderDetails.Where (o => o.Order.ShipCountry == "Spain")
where spanishOrders.Any()
orderby p.ProductName
select new
	Orders = spanishOrders.Count(),	
	TotalValue = spanishOrders.Sum (o => o.UnitPrice * o.Quantity)

or as shown here:



>>> shamil at smsconsulting.spb.ru 25-06-2010 11:21 >>>
Hi All,

I can't find is the subj available or not by using LINQ for Entities?
If it's not available do you have good samples' references on how to use
ObjectQuery<...> with custom SQL using aggregare SQL functions?...

Thank you.

-- Shamil

More information about the dba-VB mailing list