title: LINQ to SQL retrieve multiple columns from single datatable including grouping and sum
body: <p>I've got a single datatable that contains the fields:</p>
  
  <pre><code>TransactionID (int),
  TransactionDate (DateTime)
  AdjustedValue (decimal)
  </code></pre>
  
  <p>I'd like to achieve in LINQ the equivalent of the following SQL:</p>
  
  <pre><code>SELECT TransactionID, TransactionDate, Sum(AdjustedValue), COUNT(*) AS ItemCount 
  FROM DATATABLE 
  WHERE TransactionDate &gt;= BeginDate 
      and TransacationDate &lt; EndDate 
  GROUP BY TransactionID 
  ORDER BY TransactionID DESCENDING
  </code></pre>
  
  <p>I've tried the following:</p>
  
  <pre><code>var query = (from lui in DTbatches.AsEnumerable()
               where lui.TransactionDate &gt;= BeginDate &amp;&amp;
               lui.TransactionDate &lt; EndDate
               group lui.TransactionID by lui.TransactionID into g
               order by g.Key descending
               select new TransactionIDListItem
               {
                    TransactionID = g.Key,
                    ItemCount = g.Count()
               }).ToList();
  </code></pre>
  
  <p>This works, but only returns the TransactionID and the count of records in the specified transaction.  How should I modify my LINQ to also include the TransactionDate and the sum(AdjustedValue) fields?</p>
  
  <p>My <code>TransactionIDListItem</code> class is defined as:</p>
  
  <pre><code>public int BatchID {get; set;}
  public DateTime TransactionDate {get; set;}
  public int ItemCount {get; set;}
  public decimal TotalValue {get; set;}
  </code></pre>