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.
精彩评论