<p>I'm a bit stuck on this. Basically I want to do something like the following SQL query in LINQ to SQL:</p>
<pre><code>SELECT f.* 
FROM Foo f
WHERE f.FooId IN (
    SELECT fb.FooId
    FROM FooBar fb
    WHERE fb.BarId = 1000
)
</code></pre>
<p>Any help would be gratefully received.</p>

Try using two separate steps:
```
```
// create a Dictionary / Set / Collection fids first
var fids = (from fb in FooBar
            where fb.BarID = 1000
            select new { fooID = fb.FooID, barID = fb.BarID })
            .ToDictionary(x => x.fooID, x => x.barID);

from f in Foo
where fids.HasKey(f.FooId)
select f
```
```