linq用group分组后怎么得到多个字段
展开全部
var sta = from s in LocalEdM.rain_hour
where s.rhTime > Starttime && s.rhTime <= Endtime
group s by s.CityName into g
select new { CityName = g.Key, totalP = g.Sum(p => p.prec),lon=g.FirstOrDefault().lon,lat=g.FirstOrDefault().lat };
where s.rhTime > Starttime && s.rhTime <= Endtime
group s by s.CityName into g
select new { CityName = g.Key, totalP = g.Sum(p => p.prec),lon=g.FirstOrDefault().lon,lat=g.FirstOrDefault().lat };
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询