title: Group repeated rows in TSQL
body: <p>I have the following table and data in SQL Server 2005:</p>
  
  <pre><code>create table LogEntries (
    ID int identity,
    LogEntry varchar(100)
  )
  
  insert into LogEntries values ('beans')
  insert into LogEntries values ('beans')
  insert into LogEntries values ('beans')
  insert into LogEntries values ('cabbage')
  insert into LogEntries values ('cabbage')
  insert into LogEntries values ('beans')
  insert into LogEntries values ('beans')
  </code></pre>
  
  <p>I would like to group repeated LogEntries so that I have the following results:</p>
  
  <pre><code>LogEntry  EntryCount
  beans     3
  cabbage   2
  beans     2
  </code></pre>
  
  <p>Can you think of any way to do this in TSQL outside of using a cursor?</p>