私のクエリは以下の通りです
SELECT SupplierId,StakeholderSupplierId,Percentage
FROM std_Stakeholders
ORDER BY SupplierId
以下のような結果が得られます
SupplierId StakeholderSupplierId Percentage
1 3175 68.00
2929 5504 25.00
5504 1 68.25
5504 3238 50.00
5504 2810 23.00
この出力を として変換したい。
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
joins と pivoting を試しました。目的の出力を得るための適切なクエリを作成できませんでした。誰でも私を助けてくれますか
注: StakeholderSupplierId は static ではありません。1 から n まで変化する可能性があります