我有以下代码:-
var distinctValues = DtSet.Tables["tblData"].AsEnumerable()
.Select(row => new
{
name_1 = "1",
name_2 = "I",
name_3 = row.Field<string>("EorD"),
name_4 = row.Field<string>("InvNo")
})
.Distinct();
如果我有另一个包含 2 列“InvNo”和“Amount”的数据表 (DtSet.Tables["tblCost"]),如何在我的第一段代码中添加第五列以恢复每个列的金额总和tblCost 上的 InvNo?像 :-
var distinctValues = DtSet.Tables["tblData"].AsEnumerable()
.Select(row => new
{
name_1 = "1",
name_2 = "I",
name_3 = row.Field<string>("EorD"),
name_4 = row.Field<string>("InvNo")
name_5 = **Summed total of Amount column on tblCost per InvNo**
})
.Distinct();