title: LINQ with Group By and Having Clause with Min(string)
body: <p>There are examples with <strong>group by</strong> - <strong>having count</strong> or <strong>select minimum date</strong> with <strong>linq</strong> on the web but I couldn't find a particular solution for my question. And also I don't have an advanced linq understanding to combine these solutions that I found so far.</p>
  
  <p>I have a SQL query like this:</p>
  
  <pre><code>select client_id 
  from my_table /* Column1 : client_id, Column2 : _month */
  group by client_id
  having min(_month) = '2009-11'
  </code></pre>
  
  <p><strong>My question is: How can I convert this query into c# linq?</strong>. 
  So far I wrote something like this but it doesn't give what I have to have:</p>
  
  <pre><code>var query = dataTable.AsEnumerable() // This is my_table
    .GroupBy(c =&gt; c.Field&lt;Int32&gt;("client_id"))
    .Select(g =&gt; new
    {
        g.Key,
        minMonth = g.Min(c =&gt; c.Field&lt;string&gt;("_month"))
    })
    .Where(d =&gt; d.minMonth == "Some String like '2009-11'");   
  </code></pre>
  
  <p>It actually gives me the result of this SQL which I don't need:</p>
  
  <pre><code>select client_id, min(_month) 
  from my_table 
  where _month = '2009-11' 
  group by client_id
  </code></pre>
  
  <p>Note: _month is a string which is formatted like YYYY-MM.</p>