I have the table in below format :
| id | year | column1 | column2 | column3 |
|---|---|---|---|---|
| 1 | 2000 | 10 | 20 | 30 |
| 1 | 2001 | 100 | 200 | 300 |
I want the transformed version to be like -
| id | Field | value_2000 | value_2001 |
|---|---|---|---|
| 1 | column1 | 10 | 100 |
| 1 | column2 | 20 | 200 |
| 1 | column3 | 30 | 300 |
Appreciate any input!
I was able to take the column names in rows using unnest function. But facing some issues with taking the corresponding values.