日期:2014-05-20 浏览次数:20946 次
//Functions left join Resos var result = (from x in Resos join y in RoleFunctionMappings on x.Id equals y.FunctionId into z from y in z.DefaultIfEmpty() select new { ResourceValue = x.ResourceValue, ParentFunctionId = x.ParentFunctionId, x.PagePath, Id = x.Id, x.FunctionType, FunctionCode = x.FunctionCode, MappingId = y == null ? -1 : y.Id, IsDeny = y == null ? false : y.IsDeny, IsDefaultFunction = y == null ? false : y.IsDefaultFunction, x.Level , x.ShowSequence }).OrderBy(Item=>Item.Level).ThenBy(item=>item.ShowSequence);
------解决方案--------------------
var query= from to in db.hotel_user_order join t1 in db.hotelinfo on to.hotelid equals t1.id into left from t1 in left.DefaultIfEmpty() group to by new {to.hotelid,t1.cname} into g select new { hotelid=g.Key.hotelid, sellCount=g.Count(), cname=g.Key.cname };
------解决方案--------------------