left join linq

一直没弄明白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 {....});
发布了104 篇原创文章 · 获赞 19 · 访问量 24万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章