1

我有一个这样的查询:

SELECT '35111212', '11245452', '42215512'...... and more values.

这导致:

(No column name)    (No column name)    (No column name)
--------           --------            --------
35111212           11245452            42215512

我需要将其转换为:

(No column name)
--------
35111212
11245452
42215512

不使用“联合”可以吗?我在选择中有大量的值。

4

1 回答 1

1

如果您的列被命名,您可以这样做:

select val from  
( 
   select col1 = '1', col2 = '2', col3 = '3'
) a
unpivot 
(
   var for col in (col1, col2, col3)
) as unpvt
于 2013-05-09T09:43:18.827 回答