title: Linq to Entity with multiple left outer joins
body: <p>I am trying to understand left outer joins in LINQ to Entity. For example I have the following 3 tables:</p>
  
  <p>Company, CompanyProduct, Product</p>
  
  <p>The CompanyProduct is linked to its two parent tables, Company and Product.</p>
  
  <p>I want to return all of the Company records and the associated CompanyProduct whether the CompanyProduct exists or not for a given product. In Transact SQL I would go from the Company table using left outer joins as follows: </p>
  
  <pre><code>SELECT * FROM Company AS C
  LEFT OUTER JOIN  CompanyProduct AS CP ON C.CompanyID=CP.CompanyID
  LEFT OUTER JOIN  Product AS P ON CP.ProductID=P.ProductID 
  WHERE      P.ProductID = 14 OR P.ProductID IS NULL
  </code></pre>
  
  <p>My database has 3 companies, and 2 CompanyProduct records assocaited with the ProductID of 14. So the results from the SQL query are the expected 3 rows, 2 of which are connected to a CompanyProduct and Product and 1 which simply has the Company table and nulls in the CompanyProduct and Product tables. </p>
  
  <p>So how do you write the same kind of join in LINQ to Entity to acheive a similiar result? </p>
  
  <p>I have tried a few different things but can't get the syntax correct.</p>
  
  <p>Thanks.</p>