title: checking if all the items in list occur in another list using linq
body: <p>I am stuck with a problem here. I am trying to compare items in a list to another list with much more items using linq.</p>
  
  <p>For example:</p>
  
  <pre><code>list 1: 10,15,20
  list 2: 10,13,14,15,20,30,45,54,67,87
  </code></pre>
  
  <p>I should get <code>TRUE</code> if all the items in <code>list 1</code> occur in <code>list 2</code>. So the example above should return <code>TRUE</code></p>
  
  <p>Like you can see I can't use <code>sequenceEquals</code> </p>
  
  <p>Any ideas?</p>
  
  <p>EDIT:</p>
  
  <p>list2 is actually not a list it is a column in sql thas has following values:
  <code>&lt;id&gt;673&lt;/id&gt;&lt;id&gt;698&lt;/id&gt;&lt;id&gt;735&lt;/id&gt;&lt;id&gt;1118&lt;/id&gt;&lt;id&gt;1120&lt;/id&gt;&lt;id&gt;25353&lt;/id&gt;</code>.</p>
  
  <p>in linq I did the following queries thanks to Jon Skeets help:</p>
  
  <pre><code>var query = from e in db
              where e.taxonomy_parent_id == 722
              select e.taxonomy_item_id;
  </code></pre>
  
  <p>query is <code>IQueryable</code> of longs at this moment</p>
  
  <pre><code>var query2 = from e in db
               where query.Contains(e.taxonomy_item_id)
               where !lsTaxIDstring.Except(e.taxonomy_ids.Replace("&lt;id&gt;", "")
                                                         .Replace("&lt;/id&gt;", "")
                                                         .Split(',').ToList())
                                   .Any()
               select e.taxonomy_item_id;
  </code></pre>
  
  <p>But now I am getting the error <code>Local sequence cannot be used in LINQ to SQL implementation of query operators except the Contains() operator</code>.</p>