Adi Cohen
Adi Cohen

Reputation: 31

Transposed table redshift

I want to transpose columns into rows (without using UNION):

|Dimension1 | Measure1 | Measure2 |
-----------------------------------
|     1     |   x1     |  y1      |
|     0     |   x2     |  y2      |

Into:

   | Dimension1 |  Measures |  Values |
   -----------------------------------
   | 1          |  Measure1 |    x1   |
   | 1          |  Measure2 |    y1   |
   | 0          |  Measure1 |    x2   |
   | 0          |  Measure2 |    y2   |

The number of the measure is fixed.

I'm using Amazon Redshift.

Upvotes: 0

Views: 1110

Answers (1)

Jon Ekiz
Jon Ekiz

Reputation: 1022

You need to use Union for that. Why don't you want to use it ? There is no other way.

Upvotes: 1

Related Questions