1 //INNER JOIN 2 var query = (from u in db.UserBase 3 from g in db.UserGroup 4 where u.ID == g.PID 5 select u).ToList(); 6 //INNER JOIN 7 var query = (from a in db.UserBase 8 join b in db.UserGroup on a.ID equals b.PID 9 select new Test { id = a.ID, pid = b.PID, name = a.LoginName, Group = b.GroupName } 10 ).ToList(); 11 12 //INNER JOIN 13 var query = (from a in db.UserBase 14 join b in db.UserGroup on a.ID equals b.PID 15 join c in db.WorkGroup on b.GroupName equals c.GroupName 16 select new Test { id = a.ID, pid = b.PID, name = a.LoginName, Group = b.GroupName } 17 ).ToList(); 18 //CROSS JOIN 19 var query = (from u in db.UserBase 20 from g in db.UserGroup 21 select u).ToList(); 22 23 //LEFT OUTER JOIN 24 var query = (from a in db.UserBase 25 join b in db.UserGroup on a.ID equals b.PID into order 26 from o in order.DefaultIfEmpty() 27 //where o != null 28 select new Test 29 { 30 id = a.ID, 31 Group = o == null ? "null" : o.GroupName, 32 name = a.LoginName, 33 pid = o == null ? 0 : o.PID 34 } 35 ).ToList();