title: SQL Query pivoting or grouping
body: <p>I have an issue in making a SQL query to sort out a datatable and dont know how to approach it. That is, i have a datatable that looks like this:</p>
  <p><img src="https://i.stack.imgur.com/55Fx1.png" alt="enter image description here" /></p>
  <p>And i would like to query it like this:</p>
  <p><img src="https://i.stack.imgur.com/68F9x.png" alt="enter image description here" /></p>
  <p>For retrieving the initial datatable i'm using following query:</p>
  <pre><code>SELECT top 100 replace(convert(varchar, db1.Create_On,101),'/','') + replace(convert(varchar, db1.Create_On,108),':','') as 'Creation_Date', db1.PSP, db1.Create_on, db1.Create_by, db1.Language, db1.Name, db1.FirstName, db2.*
  from db1 INNER JOIN
       db2
       ON (db1.IB_H_Id = db2.IB_H_Id) AND (db1.Create_on = db2.Create_on) AND (db1.Create_by = db2.Create_by)
  WHERE (((db1.IB_H_Id)='CLA_052') AND ((db1.SendMail) Like '') AND ((db2.Answer_Char) = 'Email') OR ((db2.Answer_Char) = 'Card'))
  order by [Creation_Date];
  </code></pre>
  <p>Now i don't know how to approach it whether with group by or pivot. Thanks for the help!</p>