title: Need help with LINQ to SQL WHERE-clause on foreign table
body: <p>Let's say I have these two tables:</p>
  
  <pre><code>ParentDataItem
      ParentDataItemID
      ...some other fields...
  
  ChildDataItem
      ChildDataItemID
      ParentDataItemID (foreign key)
      Name
      Value
  </code></pre>
  
  <p>Now I want to select any ParentDataItems that have a ChildDataItem with a specified name and value.</p>
  
  <p>I know I was way off with my first approach, which was something like:</p>
  
  <pre><code>// db is the data context object
  db.ParentDataItems.Where(p =&gt; p.ChildDataItems.Where(c =&gt; c.Name == "XXX" &amp;&amp; c.Value == "XXX"));
  </code></pre>
  
  <p>I prefer lambda syntax but either would do.</p>