title: SQL Server move Rows to Columns
body: <p>I shall appreciate some help. I have a table in an SQL Server DB called info_source with the following data:</p>
  
  <pre><code>Date        StatCode  Value_1  Value_2  Remarks
  ----------  --------  -------  -------  -------
  2012-11-01  SRC_1     18775     648     Normal
  2012-11-01  SRC_2     308218    249     Normal
  2012-11-01  SRC_3     0         0       Off
  2012-11-02  SRC_4     123181    523     Normal
  2012-11-02  SRC_5     189231    247     Normal
  </code></pre>
  
  <p>I will be replacing the <code>statCode</code> field with the name of the station using a join. I would like the rows converted to columns to be used in reports something similar to this:</p>
  
  <pre><code>Date       StatName   Value_1 Value_2 Remarks StatName   Value_1 Value_2 Remarks
  ---------- ---------- ------- ------- ------- ---------- ------- ------- -------
  2012-11-01 (SRC_1)ABC 18775   648     Normal  (SRC_2)DEF 308218  249     Normal
  2012-11-02 (SRC_4)JKL 123181  523     Normal  (SRC_5)MNO 189231  247     Normal
  </code></pre>
  
  <p>I was going to create a view but couldn't solve the problem. Than I researched and found some information about pivot tables but I could not get to grips on how to write a query that does what I want.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>This is what I have tried so far:</p>
  
  <pre><code>SELECT * FROM (
   SELECT date AS [date], statCode AS [station], value_1 AS [val1],
   value_2 AS [val2], remarks AS [remks] FROM info_source
  ) AS query1
  </code></pre>