Mid From PDF EF Core Entity Framework Core

How to do grouping, aggregation (Sum, Count, Max, Min) via LINQ?

var groupedData = context.Orders

.GroupBy(o => o.CustomerId)

.Select(g => new

{

CustomerId = g.Key,

TotalOrders = g.Count(),

TotalAmount = g.Sum(o => o.Amount),

MaxAmount = g.Max(o => o.Amount),

MinAmount = g.Min(o => o.Amount)

});

More from Entity Framework Core Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details