title: LINQ query with SELECT and two GROUP-BY condition
body: <p>What's the equivalent LINQ instruction for a <code>Datatable</code> of the following SQL query:</p>
  
  <pre><code>SELECT code_direction, count(TP) AS CN 
  FROM table1 
  WHERE cod_time = 'A011' 
  GROUP BY TP,code_direction;
  </code></pre>
  
  <p>and how to get the result into a new datatable?</p>
  
  <p>I tried to convert it but I there're some errors. Someone could take a look on this:</p>
  
  <pre><code>    var query = from t in table1.AsEnumerable()
                  group t by new { t.TP, t.code_direction }
                      into grp
                      select new
                      {
                          grp.Key.code_direction,
                          CN = grp.Count(t.TP)
                      };
      foreach (var x in query)
      {
          Console.Write(x.code_direction);
          Console.Write(x.CN);
      }
  </code></pre>