0
有一個表,如下圖所示:我如何表列轉換爲行
+-----------+------------+--------+ | Col1 | Col2 | Col3 | +-----------+------------+--------+ | 12345678 | FirstName | John | | 12345678 | LastName | Smith | | 987456321 | LastName | Clancy | | 987456321 | MiddleName | T | | 987456321 | Height | 176cm | | 654125878 | FirstName | Tan | | 654125878 | Weight | 150lb | +-----------+------------+--------+
如何將其轉換成:
+-----------+-----------+------------+----------+--------+--------+ | ID | FirstName | MiddleName | LastName | Height | Weight | +-----------+-----------+------------+----------+--------+--------+ | 12345678 | John | null | Smith | null | null | | 987456321 | null | T | Clancy | 176cm | null | | 654125878 | Tan | null | null | null | 150lb | +-----------+-----------+------------+----------+--------+--------+