C# DataTable 多列分组方式
DataTable dtGroupBy = dt_com_sub.AsEnumerable().GroupBy(r => new { BudgetSubjectID = r["BudgetSubjectID"], Subjectid = r["Subjectid"], ItemNo = r["ItemNo"] }).Select(
g =>
{
var row = dt_com_sub.NewRow();
row["BudgetSubjectID"] = g.Key.BudgetSubjectID;
row["Subjectid"] = g.Key.Subjectid;
row["ItemNo"] = g.Key.ItemNo;
row["AvailableAmt"] = g.Sum(r => (decimal)r["AvailableAmt"]);
return row;
}).CopyToDataTable();