我的数据库中有两个表:
Employee(EmployeeID, EmployeeName, EmployeeGroup)
Group(GroupID, GroupName, GroupLeader)
EmployeeGroup对应GroupID
GroupLeader对应于EmployeeID
我想选择列:
EmpoyeeID, EmployeeName, LeaderName(Customer name)
我该怎么做?
答案 0 :(得分:0)
var list = dataModel.Employee.Join( dataModel.Group,
e => e.EmployeeGroup,
g => g.GroupID,
(e, g) =>
new
{
EmpoyeeID= e.EmpoyeeID,
EmployyeName= e.EmployyeName,
LeaderName= g.GroupLeader.EmployyeName
});