title: How to group records by dates in SQL Server
body: <p>Let's look at the following table</p>
  
  <pre><code>Name    TIMESTAMP   STATUS
  
  Task1   01-01-2019  COMPLETE
  Task1   01-01-2019  COMPLETE
  Task2   01-01-2019  COMPLETE
  Task3   02-01-2019  NOT COMPLETE
  Task4   01-01-2019  COMPLETE    
  Task4   02-01-2019  COMPLETE
  </code></pre>
  
  <p>What I want is the output to be like this: </p>
  
  <pre><code>Date       TaskName    How many completed?
  
  January    Task1           2
  January    Task2           1
  January    Task3           0
  January    Task4           1
  February   Task1           0
  February   Task2           0
  February   Task3           0
  February   Task4           1
  </code></pre>
  
  <p>I'm having troubles on figuring out how to group the count each task to a particular date. My table has over 10 tasks and around 100k rows and they need to be grouped by dates so we can see how many tasks were successfully completed for each month.</p>
  
  <pre><code>select DateName(month, DateAdd(month, month([TIMESTAMP]),0)-1) as 'Month', 
  count(TaskName) as 'Total Processed' 
  from myTable
  where YEAR([TIMESTAMP]) = 2019 and TaskName = 'Task1'
  group by month([TIMESTAMP]);
  </code></pre>
  
  <p>So far I know this will give me the total count of times Task1 was completed for each month in 2019, but I am struggling on how to put each task in this outputted table with their respective names. Can anyone suggest on how I can proceed? Any guidance would be great!</p>