我有以下 vb.net LINQ 查询
Dim q = From row In dx.AsEnumerable
Group row By G = New With {.Cat = row.Field(Of Integer)("catalogid")}.Cat,
New With {.Backorder = row.Field(Of Integer)("backorder")}.Backorder Into pg = Group
Select New With
{
.Cat = pg.Cat,
.Backorder = pg.Sum(Function(x) x.Backorder)
}
我有这个名为 dx 的数据表
catalogid backorder
1 5
1 10
2 1
2 5
我想Sum
backorder
列在哪里catalogid
是相同的所以结果如下
catalogid backorder
1 15
2 6
在 Select new with 部分中,有什么问题?