The table contains an identifier column, a valueHeading column, and a value column. I want to split the column of values into two new columns named valueHeading1 and valueHeading2 depending on what type of valueHeading has a value.
So, I want to join this selection:
Edit: Full connection
SELECT ID
,valueHeading
,value as 'valueHeading1'
FROM table1
WHERE valueHeading = 'valueHeading1'
Use this to select:
SELECT ID
,value as 'valueHeading2'
FROM table1
WHERE valueHeading = 'valueHeading2'
in their respective identifiers. How to do it?
Edit to illustrate what I want to do:
Source table:
ID valueHeading value
0 valueHeading1 a
0 valueHeading2 a
1 valueHeading1 ab
1 valueHeading2 NULL
2 valueHeading1 abcd
2 valueHeading2 abc
New table:
ID valueHeading1 valueHeading2
0 a a
1 ab NULL
2 abcd abc
source
share