我们有这个UNPIVOT查询。
SELECT Value
FROM (Your select statement) as x
UNPIVOT (Value FOR val IN (a, b, c, d)) as p
产生如下结果:
Value
value1
value2
value3
value4
我们如何详细说明列名?
Value ColumnName
value1 a
value2 b
value3 c
value4 d
答案 0 :(得分:-2)
感谢Giorgi。将val
添加到SELECT
子句:
SELECT Value, val
FROM (Your select statement) as x
UNPIVOT (Value FOR val IN (a, b, c, d)) as p