var result = from A in dbWork_Process join B in dbBase_Station on AStationNo equals BStationNo into AB from B in ABDefaultIfEmpty group A by new AStationNo BSortIn
var result = db.Work_Process .GroupJoin(db.Base_Station, A => A.StationNo, B => B.StationNo, (A, AB) => new { A, B = AB.DefaultIfEmpty() }) .GroupBy(x => new { x.A.StationNo, x.B.FirstOrDefault().SortIndex }) .OrderBy(x => x.Key.SortIndex) .Select(g => new { StationNo = g.Key.StationNo, Count = g.Count() });
原文地址: http://www.cveoy.top/t/topic/hw0C 著作权归作者所有。请勿转载和采集!