title: Comparing and retrieving sets of values from a table that exist in another table using linq
body: <p>I want to see if any 'rows' from table 1 are contained within table 2 and extract them from table 2 using LINQ.</p>
  
  <p>Sample scenario:</p>
  
  <pre><code>table {
     int ID
     int RowID
     int ColumnID
     string cellvalue
  }
  </code></pre>
  
  <p><strong>Table 1</strong></p>
  
  <pre><code>1, 1, 1, A
  2, 1, 2, B
  3, 2, 1, C
  4, 2, 2, D
  </code></pre>
  
  <p><strong>Representing</strong></p>
  
  <pre><code>A | B
  C | D
  </code></pre>
  
  <p><strong>Table 2</strong></p>
  
  <pre><code>1, 1, 1, X
  2, 1, 2, Y
  3, 6, 1, A
  4, 6, 2, C
  5, 8, 1, A
  6, 8, 2, B
  7, 9, 1, A
  8, 9, 2, B
  </code></pre>
  
  <p><strong>Representing</strong></p>
  
  <pre><code>X | Y
  A | C
  A | B
  A | B
  </code></pre>
  
  <p>So in the example above, (A|B) from table 1 is also in table 2 (A|B) twice.</p>
  
  <p>The result I want from table 2 is:</p>
  
  <pre><code>5, 8, 1, A
  6, 8, 2, B
  7, 9, 1, A
  8, 9, 2, B
  </code></pre>
  
  <p>I was trying to use group by into another query and then contains but I got lost. I'm thinking its probably easier if I pivot it to form the actual rows but there's no pivot in LINQ.</p>
  
  <p>I've most likely skipped over something simple, if any one could please lend a hand? It doesn't have to be LINQ if there's a better answer.</p>
  
  <p>Cheers!</p>