【发布时间】:2016-11-08 18:49:00
【问题描述】:
我有以下数据
Col1, Col2, Col3, Col4, Col5
1, P, W, M, adhfggh
1, P, W, M, fdasdfd
1, P, W, M, retretre
所以,我想得到这个
Col1, Col2, Col3, Col4, ColA, ColB, ColC
1, P, W, M, adhfggh, fdasdfd, retretre
我应该尝试这样的事情,但不知道括号里放什么
select Col1, Col2, Col3, Col4, Col5 from tableA
Unpivot
( Col1, Col2, Col3, Col4 for Col5 in (, , ) ) as UnPvt
感谢您的帮助。
【问题讨论】:
-
您使用的是哪个 DBMS?