I have several queries with 2 from clauses that look like this:
var TheResult = from a in MyDC.Table1
from b in MyDC.Table2
where a.SomeCol == b.SomeOtherCol
select new MyModel() {....}
I’m concerned that this syntax is creating a cartesian join and I want to rewrite it with join syntax with only one from clause. My question is this: how should I determine which table should I put in the from clause?
Thanks.
Edit: the t-sql generated by the query starts with SELECT COALESCE(( is that a good/bad thing?
You can rewrite this into a JOIN pretty easily:
Or if you want a left join: