日期:2014-05-20 浏览次数:20984 次
var Query=from t in table group t by t.name select new{name=g.key,a=g.sum(v=>v.a),b=g.sum(v=>v.b),.....}
------解决方案--------------------
var re = from t in datatable
group t by new {t.a,
t.b,
t.c,
t.d} into g
select new {g.key,
e=g.Sum(k => k.a)};
------解决方案--------------------
var table = from t in _dt3.AsEnumerable()
group t by t.Field<string>("Name0") into s
select new
{
Name0 = s.Key,
Name1 = s.Sum(v => v.Field<string>("Name1")),
Name2 = s.Sum(v => v.Field<string>("Name2")),
Name3 = s.Sum(v => v.Field<string>("Name3")),
Name4 = s.Sum(v => v.Field<string>("Name4")),
Name5 = s.Sum(v => v.Field<string>("Name5")),
Name6 = s.Sum(v => v.Field<string>("Name6")),
Name7 = s.Sum(v => v.Field<string>("Name7"))
};