标签:
Linq做连表查询,可以先查出A、B表,然后再join A、B表,操作A、B组合的匿名表X
var table1=from r in shiti.a() from y in r.years where y>2010 select new { year=y, name=r.FirstName }; var table2=from t in shiti.b() from y in t.years where y>2010 select new { year=y, name=t.name } 然后根据这两个查询再通过子句join t in table1 on r.years equals t.years var tablesum=from r in table1 join t in table2 on r.years equals t.years select new { years=r.year, teams=r.name, racer=t.name }
还可以直接就写在一起
标签:
原文地址:http://www.cnblogs.com/ithuo/p/4757844.html