It's not clear to me the role that Dept
is playing here; as described it appears that Emp
s can be joined to Zone
s without using Dept
as an intermediary.
// these could be Tables in a DataContext
IEnumerable<Emp> emps;
IEnumerable<Zone> zones
var result = (from e in emps
join z in zones on e.deptId equals z.DeptId
where e.empId == employeeID
select z.ZoneType).Single();
Perhaps you meant for Dept
to have a column named ZoneID
? Then you would say:
// these could be Tables in a DataContext
IEnumerable<Emp> emps;
IEnumerable<Dept> depts;
IEnumerable<Zone> zones;
var result = (from e in emps
join d in depts on e.deptId equals d.deptId
join z in zones on d.ZoneID equals z.ZoneID
where e.empId == employeeId
select z.ZoneType).Single();
Because of the ambiguity in your question I can not give you a definitive answer but the above should be enough to point you in the right direction. If not, please feel free to post a comment requesting clarification.