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萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章