I have the following input data:
ID | P1 | P2 | P3 | Q1 | Q2 | Q3 |
---|---|---|---|---|---|---|
1 | 1 | 2 | 3 | 4 | 5 | 6 |
2 | 10 | 20 | 30 | 40 | 50 | 60 |
3 | 1 | 2 | 30 | 400 | 50 | 60 |
And I want to change it to:
ID | A | P | Q |
---|---|---|---|
1 | PQ1 | 1 | 4 |
1 | PQ2 | 2 | 5 |
1 | PQ3 | 3 | 6 |
2 | PQ1 | 10 | 40 |
2 | PQ2 | 20 | 50 |
2 | PQ3 | 30 | 60 |
3 | PQ1 | 1 | 400 |
3 | PQ2 | 2 | 50 |
3 | PQ3 | 30 | 60 |
So multiple rows for each ID, with one column stating the number behind P and Q columns, and then two columns with the corresponding values.