当我需要使用linq连接某些表时,并且当这些表由很多字段组成时,需要做很多工作才能获得所需的所有数据。例如:
var result = from i in Person
join y in Works
on i.PID euqals y.PID
join z in Groups
on y.GID on z.GID
select new {Name = i.Name, Work = y.work, WG = z.GroupName};
如何使查询返回所有表?
答案 0 :(得分:0)
我想你需要的只是这个:
var Query = from x in Table_1
join y in Table_2
on x.id equals y.id
where x.Country.Equals("X Country")
select new {x,y};