Can anyone help me translate the below sql to lambda?
SELECT a.assembly_name,
a.financial_year,
a.total_expenditure,
SUM(b.ac_bill_amount) AS TOTAL_AC_BILL
FROM fund_allotment AS a INNER JOIN mla_ac_bill AS b
ON a.assembly_name = b.assembly_name and a.financial_year = b.financial_year
GROUP BY a.assembly_name,a.financial_year,a.total_expenditure
var result = fundAllotment
.Join(mlaAcBill,
a => new { a.AssemblyName, a.FinancialYear },
b => new { b.AssemblyName, b.FinancialYear },
(a, b) => new
{
a.AssemblyName,
a.FinancialYear,
a.TotalExpenditure,
b.AC_Bill_Amount
})
.GroupBy(x => new
{
x.AssemblyName,
x.FinancialYear,
x.TotalExpenditure
})
.Select(g => new
{
g.Key.AssemblyName,
g.Key.FinancialYear,
g.Key.TotalExpenditure,
TotalACBill = g.Sum(x => x.AC_Bill_Amount)
});