开发者

Is this SQL query translatable into LINQ?

SELECT * 
FROM table1 JOIN table2 
ON table1.center BETWEEN table2.left AND table2.right

I'm new to LINQ, and I've seen that 'join' require an 'equals' keyword (instead of BETWEEN in my SQL). Perhaps I could override 'Equals' operat开发者_开发技巧or and create a new object of a LINQ query?


For things other than equals you put your join criteria in the where clause. It is similar to old style SQL where you start with a cartesian join and then filter on the where clause.

from t1 in table1
from t2 in table2
where t1.centre >= t2.left && t1.centre <= t2.right
select new { ta.centre, t1.left}; //add more fields as required.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜