title: find rows with same value using LINQ
body: <p><a href="https://i.stack.imgur.com/NZ5lU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NZ5lU.png" alt="Screen Shot from MS SQL Server Management Studio"></a></p>
  
  <p>The issue with the image above is that</p>
  
  <ul>
  <li>I want to apply a bonus share to the shareholders based on the TransLog_Date</li>
  <li>Because the shareholder in row 1 has already transferred a portion of his shares to the holder in row 3, his new share value is what shows in row 2 column 5 as 100000</li>
  <li>I want the bonus share to be calculated based on the value in row 2, column 5 but not on row 1, column 5.</li>
  <li><p>I have tried several codes in LINQ but getting it wrong as the value is multiplied on all the 3 records which is totally wrong.</p>
  
  <pre><code>    var transQuery = (from tq in db.TransactionsLogDbSet
                        where (tq.TransactionType == TransactionType.PurchaseOfShares)
                           || (tq.TransactionType == TransactionType.TransferOfShares) 
                           || (tq.TransactionType == TransactionType.BonusSharesDeclared)
                        select tq);
  
      var query = from row in db.TransactionsLogDbSet 
                  group row by row.Transholder_ID into g
                  select new { Count = g.Count() };
  </code></pre></li>
  </ul>