insert tab(field)
select field1 from table where ...
union all select field2 from table where ...
union all select field3 from table where ...
union all select field4 from table where ...
select field1 from table where ...
union all select field2 from table where ...
union all select field3 from table where ...
union all select field4 from table where ...
select 列1 from(
select 列1 from 表
union all
select 列2 from 表
union all
select 列3 from 表
union all
select 列4 from 表
) a
select 列1 from(
select 主键,列1 from 表
union all
select 主键,列2 from 表
union all
select 主键,列3 from 表
union all
select 主键,列4 from 表
) a order by 主键
select 列1 from(
select id,列1 from #t
union all
select id,列2 from #t
union all
select id,列3 from #t
union all
select id,列4 from #t
) a order by id
select 列1 from(
select 列1 from 表
union all
select 列2 from 表
union all
select 列3 from 表
union all
select 列4 from 表
) a --指定一个别名
select 列1 from 表
union all
select 列2 from 表
union all
select 列3 from 表
union all
select 列4 from 表
select top 1 列1 from 表
union all
select top 1 列2 from 表
union all
select top 1 列3 from 表
union all
select top 1 列4 from 表
create table #tt(id int,a varchar(10),b varchar(10),c varchar(10),d varchar(10))
insert #tt values(1,'a','b','c','d')
insert #t values(2,'e','f','g','h')
insert #t values(3,'i','j','k','l')
insert #t values(4,'m','n','o','p')
insert #tt(id,a,b,c,d)
select id,a,b,c,d from(
select a.id,a.a,b.b,c.c,d.d from #t a
join #t b
on a.id=b.id
join #t c
on a.id=c.id
join #t d
on a.id=d.id
) a order by idselect * from #tt
select * from #tdrop table #tt
drop table #t