linq多表join与group

var query =from a in this.ObjectContext.siteInfo 
       join b in this.ObjectContext.shopInfo on a.siteID equals b.siteID 
       group new {a,b} by new { a.Lon, a.Lat, a.siteID, b.date} into g 
       select new site_shopInfo{
         SiteID=g.Key.siteID,
         Longitude=g.Key.Lon, 
         Latitude=g.Key.Lat, 
         date=g.Key.date, 
         Totalearning=g.Sum(t => t.b.earning)};

 

posted @ 2016-06-08 23:36  shiningrise  阅读(943)  评论(0编辑  收藏  举报
// 侧边栏目录 // https://blog-static.cnblogs.com/files/douzujun/marvin.nav.my1502.css