title: SQL Statement rows to Columns
body: <p>I have a Table in MS Access like this:</p>
  
  <p>The Columns are:</p>
  
  <pre><code>--------------------------------------
  | *Date* | *Article* | *Distance* | Value |
  ---------------------------------------
  </code></pre>
  
  <p>Date, Article and Distance are Primary Keys, so the combination of them is always unique.</p>
  
  <p>The column Distance has discrete values from 0 to 27.</p>
  
  <p>I need to transform this table into a table like this:</p>
  
  <pre><code>----------
  | *Date* | *Article* | Value from Distance 0|  Value Dis. 1|...|Value Dis. 27|
  ----------
  </code></pre>
  
  <p>I really don't know a SQL Statement for this task. I needed a really fast solution which is why I wrote an Excel macro which worked fine but was very inefficient and needed several hours to complete. Now that the amount of data is 10 times higher, I can't use this macro anymore.</p>