var query = from b in (from a in (from t1 in MainN join t2 in Sec on t1.MainNo1 equals t2.secondNo1 into lg1 from t2 in lg1.DefaultIfEmpty() select t1) join td in Third on a.MainNo2 equals td.thirdNo1 into lg2 from td in lg2.DefaultIfEmpty() select a) join f in Four on b.MainNo3 equals f.fourNo1 into lg3 from f in lg3.DefaultIfEmpty() select new { b.Mainid,b.secnondNo2,b.thridNo2,fourNo2 = f == null ? 0 : f.fourNo2 };