Linq query with group by & aggregate function like sum.
I want to create a linq dynamic query using group by and aggregate function like sum on different column of same table. i am using entity framework and using one table for one query.
like below but its showing error at runtime , its not correct way to right. Please tell me how to write a correct linq query.
Query --->
var varWeldingProgressReport = context.WeldingAuditProgressReports.Where(strWhereClause).Where(i => i.ReportDt >= dtDateFrom && i.ReportDt <= dtDateTo).Select("new(" + varAggregateColWeldingAudit + ")");
var temp = context.WeldingAuditProgressReports.GroupBy("ReportDt", "it").Select("new(Key as ReportDt, Sum(Progress) as Total)");