Question: This works fine:

```
var q = (from c in db.tblLiteCategorySpecs where CategoryIDs.Contains(c.CategoryID) select c.SpecID).Distinct().ToList();
var qq = (from s in db.tblSpecifications where q.Contains(s.id) select s);

```

However I now need to return another field in the first query:

```
var q = (from c in db.tblLiteCategorySpecs where CategoryIDs.Contains(c.CategoryID) select new { c.SpecID, c.FriendlyName }).Distinct().ToList();
var qq = (from s in db.tblSpecifications where q.Contains(s.id) select s);

```

So the `q.contains` now fails, I need this to somehow work on the `q` query `SpecID` field. Anyone know how to do this?

Answer: 
Well, you could *try*:

```
var qq = from s in db.tblSpecifications
         where q.Select(x => x.SpecID).Contains(s.id)
         select s;

```

In other words, project the result before using `Contains`. I've no idea what the SQL will look like.

By the way, I'd personally just write this as:

```
var qq = db.tblSpecifications
           .Where(s => q.Select(x => x.SpecID).Contains(s.id));

```

I only use query expression syntax where it really makes things simpler. I'd also strongly encourage you to use multiple lines for the queries - it can really help with readability.
Is this what you want?

```
var q = (from c in db.tblLiteCategorySpecs where CategoryIDs.Contains(c.CategoryID) select new { c.SpecID, c.FriendlyName }).Distinct().ToList();
var qq = (from s in db.tblSpecifications where q.Any(c => c.SpecID == s.id) select s);

```