linq

Join & Left Join

2018-01-10  本文已影响13人  落地成佛

1、Join

1.1定义

image.png

1.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
上一篇 下一篇

猜你喜欢

热点阅读