title: SQL grouping rows by date and showing counts for each date
body: <p>Using SQL Server 2012, I have a list of transactions each with a timestamp for the time the transaction occurred. I would like to display a column of dates where transactions occurred and a second column showing the number of transactions that occurred for each date.</p>
  
  <p>I've managed to display the column of dates where transactions occurred, but am having trouble with the second portion. My code for the first is:</p>
  
  <pre><code>select distinct convert(varchar(10), Timestamp, 111) as 'TransactionDates'
  from Transactions 
  </code></pre>
  
  <p>which returns dates where a transaction took place.</p>
  
  <p>I assume that for the second part of the select statement where I'm finding the number of transactions for each day I use a count of the exact same statement like so:</p>
  
  <pre><code>select distinct convert( varchar(10), Timestamp, 111) as 'TransactionDates',
  count(distinct convert( varchar(10), Timestamp, 111)) as 'NumTransactions'
  from Transactions
  </code></pre>
  
  <p>which should result in a second column called <code>NumTransactions</code> with a count of how many times each date has been recorded in a row. I may be misinterpreting the proper use of the Count function or perhaps there is a much easier way to do this.</p>