标签:sele lambda list() use als otto audit class pre
var q1 = db.IntelligenceTable.Where(x => x.IsUsable == 0).GroupJoin(db.Users, x => x.Publisher, y => y.id, (x, y) => new { x, PName = y.FirstOrDefault().Name }).GroupJoin(db.Users, x => x.x.Auditor, y => y.id, (x, y) => new { x.x.id, x.x.Contents, x.PName, AName = y.FirstOrDefault().Name }).ToList();
var q2 = (from i in db.IntelligenceTable join pu in db.Users on i.Publisher equals pu.id into pui from pu in pui.DefaultIfEmpty() join pa in db.Users on i.Auditor equals pa.id into pai from pa in pai.DefaultIfEmpty() select new { i.id, i.Contents, Pn = pu.Name, Pa = pa.Name }).ToList();
ps:三联合(主) IntelligenceTable (从)Users
pss:自用的
标签:sele lambda list() use als otto audit class pre
原文地址:https://www.cnblogs.com/xianyv/p/11888387.html