ID | NAME | Description
A A Value1
A A Value2
B B Value1
C C Value1
C C Value2
C C Value3
D D Value1
D D Value2
D D Value3
D D Value4
D D Value5
D D Value6
我有這個輸入,我想把它轉換成這個。旋轉與預定義的標題表
ID | NAME | Desc1 | Desc2 | Desc3 | Desc4 | Desc5 | Desc6
A A Value1 Value2
B B Value1
C C Value1 Value2 Value3
D D Value1 Value2 Value3 Value4 Value5 Value6
我已經嘗試過做透視和轉換。但不會去任何地方。
transform max([Description])
select ID, [Description]
from TableName
Group ID
Pivot [Description]
任何幫助將apprecaited。
可能的重複[將多行轉換爲具有唯一鍵的列](https://stackoverflow.com/questions/45898593/transform-multiple-rows-into-columns-with-unique-key) – June7