I have data in a table in a 'key-value' pairing format - for each Id
you can have multiple key/value
pairing values with additional column specifying Table value.
DataTable:
ID Table Key Value
-- -- -- --
221 Tab1 Field2 Jon
221 Tab1 Field5 Snow
221 Tab1 Field4 Male
221 Tab1 Field3 Pass
2256 Tab1 Field2 Jil
2256 Tab1 Field5 Dark
Data in Key
column refers to actual column name refered to by (table)data in Table column.
Now, I want pivot this data such that each ID
is only represented as a single row in relevant table and data copied to appropriate column:
Tab1:
Id Field1 Field2 Field3 Field4 Field5 Field6
-- -- -- -- -- -- --
221 Jon Pass Male Snow
2256 Jil Dark
How do I go about writing this?