I have a KVP Key value pair Table, Need sql to make it relational structure...!
- by Muthuveerappan
I have a KVP Table and the structure is ID, Key, Value and below are the sample values....
Table with values
ID , Key, Value
1 , STATUS, TRUE
1, AGE GROUP, 10
1, TRAVEL, Y
2 , STATUS, FALSE
2, AGE GROUP, 20
2, TRAVEL, N
I want these date to transform as below (Output)
ID , STATUS, AGE GROUP, TRAVEL
1, TRUE , 10, Y
2, FALSE, 20, N
I have read about crosstab/pivot - but not able to make a query which can give me the above output. The table structure cant be changed...! My bad.
Is there any way in sql, to make my output look like above ?