title: LINQ sum datatable column where
body: <p>I've a LINQ syntax where I'm getting the sum of a column, but I want to get the sum of a column where another column contains a particular value. </p>
  
  <p>Here is my syntax :</p>
  
  <pre><code>var sum = dt.AsEnumerable().Sum(dra =&gt; dra.Field&lt;int&gt;(3));
  </code></pre>
  
  <p>Here, dt is the datatable, 3 is the column index. Datatable data could be :</p>
  
  <pre><code>a     b     c      d
  1     4     6      7
  2     0     7      5
  2     7     8      6
  3     6     9      3
  3     5     1      6
  </code></pre>
  
  <p>The datatable column index would be 2 for where condition. </p>
  
  <p>How can I apply <strong>WHERE</strong> condition ?</p>