假设我有两个表:
Tab1(id, shareid, ....)
Tab2(id, shareid, ...)
DB由EF建模。 然后我想要一个linq获得与以下sql相同的结果:
select t1.* from Tab1 t1 join Tab2 t2 on t1.shareid=t2.shareID
所以linq应该是这样的:
ObjectContext.Tab1s.Where(...);
如何为此请求编写linq?
答案 0 :(得分:0)
我想这会是这样的:
var Result = (from t1 in TBL1
join t2 in TBL2 on t1.SharedId equals t2.SharedId
where t1.whatever == t2.whatever
select new{bla,bla,bla,bla} );