1.左连接 select a.filed1,a.filed2,b.filed1 from a (左表) left join b(右表) on a.commonfiled = b.commonfiled 查询思路:按照匹配字段(外键),b表记录与a表记录进行逐一匹配,若有n条匹配,则形成n行.若无匹配,则左表中得记录是全的,即使右表没有匹配的字段存在 2.右连接 select a.filed1,a.filed2,b.filed1 from a (左表) right join b(右表) on a.…
1.左连接: var LeftJoin = from emp in ListOfEmployees join dept in ListOfDepartment on emp.DeptID equals dept.ID into JoinedEmpDept from dept in JoinedEmpDept.DefaultIfEmpty() select new { EmployeeName = emp.Name, DepartmentName = dept != null ? dept.Nam…