我正在使用带有 llblgen 的 linq 查询,它给了我一个错误,任何人都可以帮我解决这个问题。这是我的查询
var reuslt = from cc in _metadata.TableName
where cc.StdId == 125
group cc by new { cc.Column1, cc.Column2 } into gr
select new
{
Col1 = gr.Key.Column1,
Col2 = gr.Key.Column2,
IncomeType1 = gr.Sum(x => x.TypeId == 1 ? x.MonthlyIncome : 0),
IncomeType2 = gr.Sum(x => x.TypeId == 2 ? x.MonthlyIncome : 0)
};
当我执行错误时,此查询中发生的result.ToList()
错误:
The multi-part identifier "LPLA_3.TypeId" could not be bound.
The multi-part identifier "LPLA_3.MonthlyIncome" could not be bound.
这是数据
Id stdId column1 column2 TypeId MonthlyIncome
1 125 1234 12 1 4
2 125 1235 12 2 4
预期输出应该是
StdId column1 column2 TypeId1 TypeId2 IncomeType1 IncomeType2
125 1234 12 1 2 4 4
请帮我