I have table like that below in my Microsoft SQL server. I want to convert the rows into column.
My issue is I don't know the result ahead and there can be more than 3 rows in the result.
Current table
ID - Function - Result - MasterKey
1 - 100 - 31 - 7
1 - 125 - 34 - 7
1 - 138 - 39 - 7
. - . - . - .
. - . - . - .
Desired Result
MasterKey - Function1 - Result1 - Function2 - Result2 - Function3 - Result3 - ...
7 - 100 - 31 - 125 - 34 - 138 - 39 - ...
How can I achieve it ? Thanks in advance.