DataTable dt = new DataTable(); var ary = from t in dt.AsEnumerable() group t by t.Field<int>("gid") into g select new { g.Key, count = g.Sum(tt => tt.Field<string>("f1").Trim() == "" ? 0 : 1) };
var ary = from t in dt.AsEnumerable() group t by t.Field<int>("gid") into g select new { g.Key, f1count = g.Count(tt => tt.Field<string>("f1")) };这样行不行
var ary = from t in dt.AsEnumerable()
group t by t.Field<int>("gid") into g
select new { g.Key, count = g.Sum(tt => tt.Field<string>("f1").Trim() == "" ? 0 : 1) };
group t by t.Field<int>("gid") into g
select new { g.Key, f1count = g.Count(tt => tt.Field<string>("f1")) };这样行不行