一直没弄明白linq 的左链接查询,终于找到解决方案了:
var result = (from a in table1
join b in table2 on a.a_guid equals b.b_guid into t1
from b in t1.DefaultIfEmpty()
join c in table3 on a.a_guid equals c.c_guid into t2
from c in t2.DefaultIfEmpty()
join e in table4 on a.a_userid equals e.e_userid into t3
from e in t3.DefaultIfEmpty()
orderby a.CreateWhen
select new {....});
本文详细解析了如何使用LINQ实现左连接查询,通过具体的C#代码示例展示了多表左连接的过程,包括连接条件及默认为空的情况处理。
2728

被折叠的 条评论
为什么被折叠?



