0
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' operator and create a new object of a LINQ query?

abatishchev
  • 95,331
  • 80
  • 293
  • 426
Juan
  • 14,840
  • 23
  • 98
  • 182
  • Assuming the issue is join by two columns, see this question: http://stackoverflow.com/questions/345427/linq-to-sql-join-multiple-columns-from-the-same-table – Kobi Aug 24 '10 at 08:48

1 Answers1

4

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.
Ben Robinson
  • 21,319
  • 5
  • 61
  • 78