我有点卡在这上面。基本上我想做类似以下SQL查询的事情:
select
c.Code, c.name, c.Family,
Parent= (select cc.name + '' + cc.Family
from Customers cc
where cc.ID = c.F_ParentID)
from
Customers c
答案 0 :(得分:1)
我可以使用此代码而不是代码:
var q = from u in db.Customers
let z = db.Customers
.Where(y => y.ID == u.F_ParentID)
.Select(y => y.Name + " " + y.Family).FirstOrDefault()
select new
{
u.ID,
Name = u.Name,
Family = u.Family,
Parent = z
};