0

Our .NET Web API controller's GET method has entity framework join logic which looks like this:

from myTableAlias in db.myTable

join ruAlias in db.ru
on myTableAlias.someField equals ruAlias.someField

where...

The above join allows me to set an alias for one table - the db.ru table. On the line below join, what if I don't want to reference myTableAlias, but rather want to define a new alias to a third table and join with that? Something like:

from myTableAlias in db.myTable

join ruAlias in db.ru, thirdTableAlias in db.thirdTable
on thirdTableAlias.someField equals ruAlias.someField

where...

Obviously thirdTableAlias can't be defined in this way. I tried adding another from keyword like from thirdTableAlias in db.thirdTable, but I was informed that I shouldn't use multiple froms here.

How can I define both ruAlias and thirdTableAlias in this example?

Kyle Vassella
  • 2,296
  • 10
  • 32
  • 62
  • 1
    https://stackoverflow.com/questions/9720225/how-to-perform-join-between-multiple-tables-in-linq-lambda – Xedni Dec 15 '18 at 02:08
  • So you don't want a join between `myTableAlias` and either of the other two tables? So you want a cartesian product or cross join there? – adam0101 Dec 17 '18 at 22:07

0 Answers0