var result = fruit.GroupBy(i => i.date)
.Select(i => new
{
date = i.Key,
no_of_apple = i.Where(j => j.fruit_code == "apple").Sum(k => k.count),
no_of_pear = i.Where(j => j.fruit_code == "pear").Sum(k => k.count)
});
相关文章
- 10-06在LINQ中实现多条件联合主键LEFT JOIN
- 10-06按条件从左往右移除数组中的元素
- 10-06LINQ 按多个字段排序(orderby、thenby、Take)
- 10-06Excel/WPS 按条件合并多行
- 10-06Linq in条件查询
- 10-06linq 多条件查询
- 10-06转 --简单解决Linq多条件组合问题
- 10-06Linq查询条件里有可空字段比较时报错variable '<>h__TransparentIdentifier2' of type referenced from scope '', but it is not defined
- 10-06需求解决 _按条件显示 _20210827
- 10-06CodeGo.net>在GroupBy和Sum聚合的ObservableCollection上使用LINQ