My query is as below
SELECT SupplierId,StakeholderSupplierId,Percentage
FROM std_Stakeholders
ORDER BY SupplierId
which yields me result as below
SupplierId StakeholderSupplierId Percentage
1 3175 68.00
2929 5504 25.00
5504 1 68.25
5504 3238 50.00
5504 2810 23.00
I want to transform this output as .
SupplierId StakeholderSupplierId1 Percentage StakeholderSupplierId2 Percentage StakeholderSupplierId3 Percentage
1 3175 68.00
2929 5504 25.00
5504 1 68.68 3238 50.00 2810 23.00
I tried with joins and pivoting . couldn't succeed in writing a proper query to get the desired output . Can anyone help me out
Note: StakeholderSupplierId is not static . it may vary from 1 to n