title: C# LINQ nested select query
body: <p>I have a scenario in following nested </p>
  
  <pre><code>--Orders (List) 
   ----Products (List)
   ------Manufacturers (List) 
         FIELDS 
          -Name
          -Address
          -City 
  </code></pre>
  
  <p>In this scenario, I would need to execute query which will filter on <strong>City</strong> of <strong>Manufacturers</strong> and returns <code>Orders, Products &amp; only matching city manufacturers</code></p>
  
  <p>I tried to put following query, however I am getting all list of <strong>Products</strong> even though city doesn't match to <strong>Manufacturers</strong>.</p>
  
  <pre><code>var filteredOrders = from o in Orders
                      from t in o.Products                           
                      where t.Manufacturers.Any(v =&gt; v.City == "Hartford")
                      select o;
  </code></pre>
  
  <p>Or even if I change from <code>select o</code> to 'select t.Manufacturers' I am getting all list of Manufacturers irrespective of city filter.</p>
  
  <blockquote>
    <p>Luckily I got W3school SQL sample which matches to my scenario. 
    <a href="https://www.w3schools.com/sql/trysql.asp?filename=trysql_op_or" rel="nofollow noreferrer">https://www.w3schools.com/sql/trysql.asp?filename=trysql_op_or</a></p>
  </blockquote>
  
  <p>SQL Query:</p>
  
  <pre><code>SELECT o.OrderId, p.ProductName, s.* 
  FROM [Orders] o 
  JOIN OrderDetails od ON o.OrderId = od.OrderId AND o.orderId = 10248 
  JOIN Products p ON od.ProductId = p.ProductId
  JOIN Suppliers s ON p.SupplierId = s.SupplierId and s.City ='Singapore'    
  </code></pre>