62,047
社区成员
发帖
与我相关
我的任务
分享
Select A.*,B.MenuName as ParentName From sys_menu A left join sys_menu B on B.MenuCode = A.ParentCode
var q= from a in sys_menu
join b in sys_menu on a.ParentCode equals b.MenuCode into lg
from b in lg.DefaultIfEmpty()
select new {a,ParentName=b==null?"":b.MenuName};
public int id{get;set;}
public string name{get;set;}
public icollection<child> child{get;set;}
Child模型:
public int id{get;set;}
public string name{get;set;}
public int parentid{get;set;]
public virsual parent parent{get;set;}
如果要查询某个chilid的父类的名称
则可以:
xxxxxxx.parent.name即可
var sg = (from g in dc.sgroup
join gu in dc.sgroupuser on g.gKey equals gu.gKey into l
from lgu in l.DefaultIfEmpty()
select new { g, lgu }).ToList();
select g.*,gu.* from g loft join gu on gu.gKey = g.gKey
var list = entities.TableA.GroupJoin(entities.TableB, a => a.uid, a => b.id, (a, b) => new { a, b }).Select(o => o).ToList();
GroupJoin in lambda expresssion