title: Linq: Select 1st item from other group
body: <p>I am trying to write a query to find just one item from the group, where they grouped by Industry and Weight, then from this one I have to get where Weight is Max and Balance is Max too
  This is the example:</p>
  
  <pre><code>var data = new[] {
  new {ID = 1, Industry = 2, Weight = 2, Balance = 500}, 
  new {ID = 2, Industry = 2, Weight = 2, Balance = 300}, 
  new {ID = 3, Industry = 2, Weight = 1, Balance = 100},
  new {ID = 5, Industry = 4, Weight = 1, Balance = 100}, 
  new {ID = 6, Industry = 4, Weight = 2, Balance = 150}, 
  new {ID = 7, Industry = 4, Weight = 1, Balance = 300},
  };
  
  var res = from a in data group a by new {a.Industry, a.Weight} into g
  let ID = g.First().ID
  let Balance = g.Max(a =&gt; a.Balance)
  select new { ID, g.Key.Industry, g.Key.Weight, Balance};
  Console.WriteLine(res);
  </code></pre>
  
  <p>So as the result I should get just two records</p>
  
  <pre><code>ID   Industry   Weight   Balance
  1      2           2      500
  6      4           2      150
  </code></pre>
  
  <p>but with query above I got 4 records
  Any advice?</p>
  
  <p>Regards,
  Dmitriy</p>