declare @table table (name nvarchar(4))
insert into @tableselect '张三' union allselect '李四' union allselect '王五' union allselect '刘三' union allselect '杨二' union allselect '胡八' union allselect '赵六'--方法1:
create table #t (id int identity(1,1),name nvarchar(4))insert into #t(name) select * from @tableselect a.name,b.name from #t a left join #t b on a.id=b.id-1 where a.id%2<>0
drop table #t
--方法2:select identity(int, 1,1) AS id ,nameinto #ttfrom @tableselect a.name, b.name
from #tt a left join #tt b on a.id = b.id-1where a.id %2 <> 0drop table #tt其实是同一个方法.