title: AWS Redshift: columns into rows (wide to long)
body: <p>I'm writing a query which result will be displayed as dashboard on redash. The query is basically a sum of several columns of table within a specific time range:</p>
  
  <pre><code>SELECT
     sum(col_A),
     sum(col_B),
     sum(col_C)
  FROM
     table_X
  WHERE
     timestamp &gt; '2018-01-01'
     AND timestamp &lt; '2018-02-01'
  </code></pre>
  
  <p>The result is something like this:</p>
  
  <pre><code>col_A    col_B    col_C    
  123      456      789
  </code></pre>
  
  <p>However, to render the dasboard on redash properly, I need the result in long format:</p>
  
  <pre><code>column   sum
  col_A    123
  col_B    456
  col_C    789
  </code></pre>
  
  <p>How can I cast the result from wide to long format?</p>