0
輸入數據SQL服務器 - 透視 - 行入列的多個VARCHAR列
需要轉動ID數據。和所需的輸出如下:
輸出所需
需要適當的解決方案,這將給有效輸出。
添加文本作爲替代圖像:
輸入數據:
+---+----+-------+------+------ +---------+-------+
|ID |Q_NO| SUB_CD|PR_TX |C_TX |AD_DTL_TX| B_NM |
+---+----+-------+------+------ +---------+-------+
|111| 1| A |asd |sdf |qwerwet |qqwe |
|111| 1| B |ger |sdt |uutty | ttt |
|112| 1| B |yut |www |yyjy | y |
|114| 1| A |atd |stf |qwwet |qe |
|114| 1| B |atw |rf |qwet |qwp |
|114| 2| A |aq |yf |qyet |qoe |
|117| 1| A |aee |yrr |qyet |qoe |
|117| 2| A |tq |uf |et |oe |
+---+----+-------+------+------ +---------+-------+
所需的輸出:
+---+-----------+---------+---------+-----------+------------+---------+-----------+-------------+--------------+-----------+------------+-------+----------+---------+-------------+-----------+-----------+----------+
|ID |Q_NO_1A |SUB_CD_1A| PR_TX_1A|C_TX_1A |AD_DTL_TX_1A| B_NM_1A| Q_NO_1B| SUB_CD_1B| PR_TX_1B |C_TX_1B |AD_DTL_TX_1B|B_NM_1B| Q_NO_2A |SUB_CD_2A| PR_TX_2A |C_TX_2A |AD_DTL_TX_2A| B_NM_2A|
+---+-----------+---------+---------+-----------+------------+---------+-----------+-------------+--------------+-----------+------------+-------+----------+---------+-------------+-----------+-----------+----------+
|111| yes | yes | asd | sdf | qwerwet| qqwe| yes| yes| ger | sdt | uutty | ttt | null | null | null | null | null | null |
|112| null | null | null | null | null |null |yes | yes | yut | www | yyj |y | null | null | null |null | null |null |
|114| yes | yes | atd | stf | qwwet | qe | yes | yes | atw | rf | qwe | qwp | yes | yes | aq | yf | qyet |qoe |
|117| yes | yes | aee |yrr | qyet | qoe | null | null | null | null | null | null| yes | yes | tq | uf | et | oe |
+---+-----------+---------+---------+-----------+------------+---------+-----------+-------------+--------------+-----------+------------+-------+----------+---------+-------------+-----------+-----------+----------+
大多數我們希望樣本數據以及格式化文本,而不是圖片。 – jarlh
請格式化您的**必需輸出**。 – McNets