title: How to use LINQ to filter property of child collection using (.Any())
body: <p>How do I do the following SQL in LINQ? I am actually using LINQ to NHibernate (but maybe it's not possible in NHibernate LINQ due to embedded lambda expression I think). But I want to know generally how to do it in LINQ. I’ve never came across this situation before.</p>
  
  <pre><code>SELECT c.CustomerID, c.CustomerName --etc
  FROM   Customers c
         INNER JOIN Orders o
           ON c.CustomerID = o.CustomerID
  WHERE  o.Status = 1
  
  public class Customer
  {
    public int CustomerID { get; set; }
    public string CustomerName { get; set; }  
    public IList&lt;Order&gt; Orders { get; set; }
  }
  
  public class Order
  {
    public int OrderID { get; set; }
    public int CustomerID { get; set; }
  }
  </code></pre>
  
  <p>I want to do something similar to this:</p>
  
  <pre><code>var customers = 
      (from c in Customers
      where c.Orders.Where(o =&gt; o.Status == 1)
      select c).ToList();
  </code></pre>
  
  <p>THANK YOU!</p>