Join & Left Join

1、Join

1.1定义

Join & Left Join_第1张图片
image.png

1.2结果

Join & Left Join_第2张图片
image.png

2、Left Join

2.1定义

    var list = (from teacher in teachers
                join student in students on teacher.TeacherId equals student.TeacherId into temp
                from tt in temp.DefaultIfEmpty()
                select new
                {
                   teacherName = teacher.TeacherName,
                   studentName = tt?.StudentName
                }).Dump("查询语句");

2.2结果

image.png

你可能感兴趣的:(Join & Left Join)