下面的代码为每个 InvNo 带来一行,以及“SCharge”的总和:0
var Values = from data in DtSet.Tables["tblCosts"].AsEnumerable()
group data by new
{
InvNo = data.Field<double>("InvoiceNo"),
AccRef = data.Field<double>("SiteRefNum"),
}
into g
select new
{
Code = "1",
InvType = "I",
Account = g.Key.AccRef,
InvNo = g.Key.InvNo,
SCharge = g.Sum(d => d.Field<double>("SCharge"))
};
有没有办法修改它,以便我在下面得到另一组行,这次对“TCharge”列进行求和,还是我需要做一个新的查询?