0
给定一个表,为每行取两列并显示两行的最佳方法是什么?这里有一个例子:sql - 将列转移到行
declare @t table (
id int,
v1 nvarchar(max),
v2 nvarchar(max),
v3 nvarchar(max)
)
insert into @t
select 0, 'hello', 'there', 'filler'
union all select 1, 'hello', 'again', 'filler'
有像这样的表:
0 hello there filler
1 hello again filler
...我想它看起来就像这样:
0 hello filler
0 there filler
1 hello filler
1 again filler
我试着做一个UNPIVOT,但鉴于我不需要清除所有列,这对我来说并不合适。