title: Get latest record and group with highest date - LINQ
body: <p>I have table <code>Billing</code> as below</p>
  
  <pre><code>AccoundID | Group | DateOfBill
  1234      | A     | 2017-07-12
  1234      | B     | 2017-07-16
  1234      | C     | 2017-07-31
  1235      | A     | 2017-07-31
  1236      | B     | 2017-07-31
  </code></pre>
  
  <p>As you see, <code>AccountID</code> 1234 have made 3 transaction on July 2017. So I need a list where the <code>AccountID</code> 1234 must be in <code>Group</code> C because that's is latest date on that transaction.</p>
  
  <p>Here is my code snippet</p>
  
  <pre><code>var LatestAccount = from n in Billing
                      where (n.Group == "A" || n.Group == "B" || n.Group == "C")
                      group n by new { n.AccountID, n.Group } into g
                      select new { 
                          AccountId = g.Key.AccountID, 
                          Group = g.Key.Group , 
                          DateOfBill = g.Max(t =&gt; t.DateOfBill) 
                      };
  </code></pre>
  
  <p>But the result is wrong. How to do in LINQ?</p>