title: How do I count the number of rows that have a value in column "A", but have a different value in column "B" using Linq
body: <p>Sry for bad english...</p>
  
  <p>DataTable example  </p>
  
  <pre><code>| ID_UEH      | ID_F   |  
  |......1......|...10...|  
  |......1......|...11...|  
  |......2......|...10...|  
  |......2......|...12...|  
  |......3......|...10...|  
  |......3......|...13...|  
  </code></pre>
  
  <p>I want to make a function that checks if there is a line with followed specification:<br>
  - different value in column 'ID_UEH', but identical values ​​in column 'ID_F'  </p>
  
  <p>i tryed this:  </p>
  
  <pre class="lang-cs prettyprint-override"><code>(from rowA in DataTableA.Select()  
   join rowB in DataTableA.Select()  
    on rowA["ID_F"] equals rowB["ID_F"]
  where rowA["ID_UEH"] != rowB["ID_UEH"]).Count()
  </code></pre>
  
  <p>and the code return 0  </p>
  
  <p>Then i try this:</p>
  
  <pre class="lang-cs prettyprint-override"><code>(from rowA in DataTableA.Select()  
   join rowB in DataTableA.Select()  
    on rowA["ID_F"] equals rowB["ID_F"]
  where rowA["ID_UEH"] != rowB["ID_UEH"] &amp;&amp;
        rowA["ID_F"]   == rowB["ID_F"]).Count()
  </code></pre>
  
  <p>and the code return 6 (DataTableA.Rows.Count = 6)</p>
  
  <p>Then they asked me to hurry, and i did this:</p>
  
  <pre class="lang-cs prettyprint-override"><code>int numRows = 0;  
  foreach (DataRow rowA in DataTableA.Select())
  {
      numRows = tabela.Select(  
      "ID_UEH &lt;&gt; "+Convert.ToInt32(rowA["ID_UEH"]) + " AND " +  
      "ID_F= " + Convert.ToInt32(rowA["ID_F"])  
                                         ).Length;  
      if (numRows &gt; 1)
         break;
  }
  </code></pre>
  
  <p>and code return what i want.</p>
  
  <p>My question is, what i did wrong?</p>