title: Multiple Join in Entity Framework
body: <p>I have the following query in TSQL</p>
  
  <pre><code>select * from users 
  inner join linkUserPhoneNumber on users.UserId = linkUserPhoneNumber.UserId
  INNER JOIN PhoneNumber ON PhoneNumber.PhoneNumberId =
      linkUserPhoneNumber.PhoneNumberId
      where UserName = 'superuser' and password ='password'
  </code></pre>
  
  <p>I have the following query in Entity Framework</p>
  
  <pre><code>var query = (from u in myEntities.Users
    join link in myEntities.linkUserPhoneNumbers on u.UserId equals link.UserId 
    join p in myEntities.PhoneNumbers on p.PhoneNumberId equals link.PhoneNumberId
    where u.UserName == Username &amp;&amp; u.Password == Password
    select u).ToList();
  </code></pre>
  
  <p>When I try to compile it, I get </p>
  
  <blockquote>
    <p>Error  3   The name 'p' is not in scope on the left side of 'equals'.  Consider swapping the expressions on either side of 'equals'.<br>
    Error   4   The name 'link' is not in scope on the right side of 'equals'.  Consider swapping the expressions on either side of 'equals'.   </p>
  </blockquote>