次の選択ステートメントを作成しました。
SELECT x.Code, y.AttributeCode, y.Value
FROM x INNER JOIN
y ON x.Id = y.ItemCodeId
WHERE (AttributeCode = 'Length' or AttributeCode = 'Width' or AttributeCode = 'Height')
結果は次のように表示されます。
Code AttributeCode Value
1000165 Width 4
1000165 Length 19.5
1000165 Height 3.8
1000173 Length 3
1000173 Height 8
1000173 Width 5
そして、次のように表示したいと思います。
100165 Width 4 Length 19.5 Height 3.8
100173 Width 5 Length 3 Height 8
これが繰り返しである場合は申し訳ありませんが、この質問に答えるために他のいくつかの回答を調べました(MS SQLは私にとって初めてなので、検索時に適切な言語を使用していない可能性があります)。