Dynamic Pivot (row to columns)
问题 I have a Table1 : ID Instance Name Size Tech 1 0 D1 123 ABC 1 1 D2 234 CDV 2 2 D3 234 CDV 2 3 D4 345 SDF I need the resultset using Dynamic PIVOT to look like along with the headers: ID | Instance0_Name | Instance0_Size | Instance0_Tech | Instance1_Name | Instance1_Size | Instance1_tech 1 | D1 | 123 | ABC | D2 | 234 | CDV Any help would be appreciated. using Sql Server 2008. Sorry for the earlier post. 回答1: Your desired output is not exactly clear, but you can use the both the UNPIVOT and