title: LINQ to SQL GroupBy Max() lambda
body: <p>Please help me convert this to a lambda expression</p>
  
  <pre><code>SELECT [UserID], MAX(Created) Created
  FROM [UserHistory]
  WHERE userid IN (14287)
  GROUP BY [UserID]
  </code></pre>
  
  <p>Thanks!</p>
  
  <p>EDIT:
  Here's what I have so far.</p>
  
  <pre><code>List&lt;T&gt; list;  //list is populated
  
  table.Where(x =&gt; list.Select(y =&gt; y.ClientId).Contains( x.UserID))
                      .GroupBy(x =&gt; x.UserID)
                      .Select(x =&gt; new { x.UserID, x.Created })
                      .ToList();
  </code></pre>
  
  <p>When I add the GroupBy, my Select says there's no definition for x.UserID and x.Created.</p>